表名:qqlist 和 qqlist2
字段 qq
qqlist: qqlist2
[qq] [qq]
155 155
215 215
355 355
444
555
两张表中qqlist2表多出两条记录 qq字段值为444,555
请问怎么查询出这几条记录?
1、select * from t1 where q not in (select q from t2)
2、qqlist有,qqlist2没有的:
SELECT * FROM qqlist WHERE NOT EXISTS (SELECT 1 FROM qqlist2 WHERE qqlist.qq = qqlist2.qq)
3、qqlist2有,qqlist没有的:
SELECT * FROM qqlist2 WHERE NOT EXISTS (SELECT 1 FROM qqlist1 WHERE qqlist.qq = qqlist2.qq)