From: [email protected] [mailto:[email protected]] On Behalf Of Campbell, Lance Sent: Tuesday, July 09, 2013 3:25 PM To: [email protected] Subject: [SQL] delete where not in another table
DELETE FROM T1 WHERE T1.user_id NOT IN (SELECT user_id FROM T2 WHERE T2.user_id=T1.user_id); Thanks, Lance Campbell Software Architect Web Services at Public Affairs 217-333-0382 -- Try: DELETE FROM t1 USING t2 WHERE t1.user_id != t2.user_id; Test it before running on production db. Regards, Igor Neyman -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
