下面的查询给了我“#1093 - 您不能在 FROM 子句中指定目标表 'reservation_seats' 进行更新”错误。
DELETE
FROM reservation_seats
WHERE id IN ( SELECT id
FROM reservation_seats
WHERE reservation_id NOT IN ( SELECT id FROM reservation)
);
表结构:
reservation_seats - id,reservation_id,seat_no
reservation - id,txn_id,name......
reservation table(id) column is used as the foreign in the reservation_seats table.
(reservation.id = reservation_seats.reservation_id )
你能告诉我为什么会这样以及如何解决吗?
谢谢