0

我有一个名为 WPList 的 SQLite 表,它有 4 列

ID (int), ID_quote (int foreign key), ID_workperformance (int foreign key), expire_date (text)

当我尝试使用此查询消除一行时,我遇到了一个大问题:

DELETE FROM WPList WHERE ID_workperformance = 12 & ID_quote = 21

我绝对确定 ID_workperformance 12 和 ID_quote 21 存在于表中,但是当我执行此查询时没有任何反应。你能帮我吗?谢谢!!

4

1 回答 1

3

AND,不是&

DELETE FROM WPList WHERE ID_workperformance = 12 AND ID_quote = 21

它似乎&是等效的,但有点难以使用,因为你需要在你的情况下添加括号

DELETE FROM WPList WHERE ((ID_workperformance = 12) & (ID_quote = 21))

如果没有 backet,您的语法的执行计划(请参阅EXPLAIN)与

DELETE FROM WPList WHERE (ID_workperformance = 12 & ID_quote) = 21

这解释了为什么它不能按预期工作。

于 2012-09-05T12:43:02.197 回答