0

我在两个名为“电子邮件”的表中有一个公共列,如果在表 B 中找到匹配项,我需要从表 A 中删除记录。

这行得通吗?有一个更好的方法吗?

DELETE b.* FROM `tableA` b
JOIN `tableB` u
ON u.email = b.email
4

3 回答 3

4
DELETE FROM tableA WHERE email IN (SELECT email FROM tableB)
于 2013-11-05T15:50:38.713 回答
3
DELETE FROM TableA WHERE email IN (SELECT b FROM TableB)
于 2013-11-05T16:06:47.653 回答
1

去除那个*

DELETE b 
FROM `tableA` b
JOIN `tableB` u ON u.email = b.email
于 2013-11-05T15:53:24.883 回答