首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

in关键字的有关问题

2012-01-19 
in关键字的问题A表sidname1haha2null3hehe4nullB表sidname1xixi2null3heihei4hahaselect count(*) from A

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
是不算進去的。。。

热点排行