查询时not in实际查询应该是有查询结果的,但是没有
SELECT * FROM A where id not in (SELECT id FROM B)
测试:
1、查询id是否存在空值:
select * from B where id is null
2、SQL优化
select * from A where id not in (SELECT id FROM B where id is not null)
注:也可删掉那条空值记录,让程序先恢复正常
总结:not in 后面的查询结果存在空值时,查询失效