1

我试图在我的 iPhone 应用程序的 sqlite 数据库中删除两个 TABLES 条目,但我遇到了一个奇怪的错误。

DELETE Sec1Opr_Equipment.*, Sec2Opr_Equipment.* FROM 
Sec1Opr_Equipment INNER JOIN Sec2Opr_Equipment ON Sec1Opr_Equipment.ID = Sec2Opr_Equipment.ID 
WHERE Sec1Opr_Equipment.ID='1'

也试试

DELETE Sec1Opr_Equipment,Sec2Opr_Equipment
FROM Sec1Opr_Equipment
LEFT JOIN Sec2Opr_Equipment
ON Sec1Opr_Equipment.ID = Sec2Opr_Equipment.ID
WHERE Sec2Opr_Equipment.ID='1'

请任何人帮助我..提前谢谢

4

1 回答 1

1

这是不可能的,在 SQLite 中,delete 语句只能从单个表中删除记录而没有任何连接。您可以在 WHERE 子句中使用子查询:

DELETE FROM tbl1 WHERE id IN (SELECT id FROM tbl2 WHERE ...)
于 2012-05-19T07:41:48.780 回答