删除b表中与a表不同的记录
delete from b where not exists(select * from a where a.id=b.id and a.name=b.name)
delete from b where b.id not in (select a.id from a) or b.name not in (select a.name from a)
本文介绍了如何使用SQL语句删除B表中与A表不匹配的记录,包括通过内连接筛选和排除不同记录的方法。
删除b表中与a表不同的记录
delete from b where not exists(select * from a where a.id=b.id and a.name=b.name)
delete from b where b.id not in (select a.id from a) or b.name not in (select a.name from a)

被折叠的 条评论
为什么被折叠?