2012-05-19 46 views
1

我想刪除我的iPhone應用程序的sqlite數據庫中的單個查詢的兩個表條目,但得到一個奇怪的錯誤。刪除兩個表的條​​目WITH SINGLE查詢

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中刪除語句只能從單個表中刪除記錄沒有任何連接。您可以在WHERE子句中使用子查詢:

DELETE FROM tbl1 WHERE id IN (SELECT id FROM tbl2 WHERE ...)