select * from A where id not in (select id from B)
当这样一条语句出现时,一般情况下不会出什么问题
但是当表B中存在空值时如NULL时,就是遇到问题,查询不到想要的数据
因此,上面的语句可以用NOT EXISTS代替,也可以给语句加一个条件如
select * from A where id not in (select id from B where id not null)
不过这种错误在设计表时应该避免的,Id应该是作为主键存在的,或者不能为空的字段