我试图在我的iPhone应用程序的sqlite数据库中删除带有SINGLE Query的两个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'
Plz任何人帮助我.. 提前谢谢
答案 0 :(得分:1)
这是不可能的,在SQLite中,delete语句只能删除单个表中没有任何连接的记录。您可以在WHERE子句中使用子查询:
DELETE FROM tbl1 WHERE id IN (SELECT id FROM tbl2 WHERE ...)