select *
from A a
where a.id not in
(select b.id
from B b )
如上查询 如果 当 B表 的 id中有 null 时 此时数据查询不到
应该为
select *
from A a
where a.id not in
(select b.id
from B b
where b.id is not null
)
因为 not in的子集中不能有 null