2011-01-26 64 views

回答

15

你可以使用not exists

delete from user 
where not exists (select * from message m where m.userid = user.id) 
     and not exists (select * from archivedMessage am where am.userid = user.id) 
+0

是否有反對優點/缺點的`LEFT JOIN ... IS NULL`方法? – Toto 2011-01-26 13:16:22