3

我有两张桌子:

用户

编号 | 姓名 | 邮件 | 通过 | 盐

条目

编号 | uid | 标题 | 正文 | 时间戳

现在我想删除-table中不存在的entries所有行(已删除用户)uiduser

我认为这可能是这样的:

DELETE entries FROM user, entries WHERE [What comes here? I don't know :(]
4

1 回答 1

7
DELETE FROM entries WHERE uid NOT IN (SELECT DISTINCT id FROM user);
于 2012-08-28T16:42:17.130 回答