Fadhel Al-Hashim <fad...@gmail.com> wrote:
> I have two tables that contain about 5 million records. I am trying to write
> an SQL command to delete rows from table A with PK (x,y,z) where PK (x,y,z)
> is not in table B.

delete from A where not exists
(select 1 from B where A.x = B.x and A.y = B.y and A.z = B.z);

-- or

delete from A where rowid in
(select A.rowid from A left join B on (A.x = B.x and A.y = B.y and A.z = B.z)
 where B.x is null);

Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to