约束是:
我尝试过以下方式。
查询: delete from fruit where fruit.name and fruit.pos in (select * from fruit except select * from fruit_temp)
结果:
只有一个结果允许属于一个的SELECT 表达式:从fruit中删除fruit.name和fruit.pos中的 (从水果中选择*除了select * from fruit_temp)
我需要在table fruit中执行删除操作,其中的行不在fruit_temp中。
答案 0 :(得分:1)
在SQLite中,IN仅适用于单个列。
要检查多个列,您需要correlated subquery:
DELETE FROM fruit
WHERE NOT EXISTS (SELECT 1
FROM fruit_temp
WHERE fruit_temp.name = fruit.name
AND fruit_temp.pos = fruit.pos );