标签: mysql sql sql-delete
我有两张桌子:
id |名字|邮件|通过|盐
id | uid |标题|文字|时间戳
现在我要删除entries的{{1}}的所有行,uid中不存在{ - 1}} - 表 (已删除的用户)
entries
uid
我认为这可能会这样:
user
答案 0 :(得分:7)
DELETE FROM entries WHERE uid NOT IN (SELECT DISTINCT id FROM user);