日期:2014-05-20  浏览次数:20597 次

in关键字的问题
A表
sid name
1 haha
2 null
3 hehe
4 null

B表
sid name
1 xixi
2 null
3 heihei
4 haha
select count(*) from A where A.name in(select name from B); 
我回答是1 为什么 null没有算进去?

------解决方案--------------------
可自己设一个特定的标识,NULL在SQL里不比较,
可用 name is null
------解决方案--------------------
NULL!=NULL
这个是数据库常识吧...
连我这个数据库学的不怎么样的都知道....
------解决方案--------------------
null
是不算進去的。。。