Mysql Not in的问题

来源:互联网 发布:淘宝 机油之家 编辑:程序博客网 时间:2024/06/05 06:03

今天用了Mysql的not in,大致是

select * from A where A.id not in (select fid from B).

发现无论如何结果都是0条记录。

后来发现select fid from B里面有一条NULL值,查了资料才知道mysql 的not in里面如果有一个NULL值,将返回0条记录。

要解决这个问题需要把 select fid from B 变成

select fid from B where B.fid is not null

0 0
原创粉丝点击