在 Visual Studio 2010 的 SQL Server Compact Edition 中(可能是 SQL Server 和一般的 SQL,我不知道),此命令有效:
DELETE FROM foods WHERE (name IN ('chickens', 'rabbits'))
但是此命令会产生以下错误:Error near identifier f. Expecting OUTPUT.
Error near identifier f. Expecting OUTPUT.
DELETE FROM foods f WHERE (f.name IN ('chickens', 'rabbits'))
要给表起别名,您必须说:
DELETE f FROM dbo.foods AS f WHERE f.name IN (...);
我看不到这个特定DELETE语句的别名点,特别是因为(至少 IIRC)这不再符合严格的 ANSI。但是是的,正如评论所暗示的那样,其他查询形式(例如相关性)可能是必要的。
DELETE