mysql查询差集

时间:2023-03-09 16:34:55
mysql查询差集
select A.* from A left join B using(name,addr,age) where B.name is NULL;
select A.* from A left join B on A.id=B.Aid where ISNULL(B.name);

查询两个表中的差集,用ISNULL(),今天早上就遇到这样的问题,两个表都有一百多万数据,需要查询A、B表中,A表存在但B表不存在的数据。用了ISNULL()速度还行不卡。
使用如上