当子查询跟随=!=<时,不允许这样做。 < => > =或当子查询用作表达式时

时间:2015-08-30 04:57:27

标签: sql-server sql-server-2008 sql-delete

delete from gust_card

where gust_card.c_id =
(select gust_card.c_id``
from gust_card,booking,room
where
 gust_card.c_id=booking.c_id and
booking.room_id=room.room_id
and room.stranded='deluxe ' )

我想删除已预订“豪华”房间的客户的记录。

room table>> room_id , standard

guest_card table>> guest_id, guest name

booking table >> booking_id ,room_id,guest_id

1 个答案:

答案 0 :(得分:1)

您必须将等号替换为“IN”,如

-Xms256m -Xmx1024m

因为subselect可以返回多个结果行。使用“in”,可以删除子选择结果列表中包含id的所有行。