读书人

SQL查询语句

发布时间: 2012-03-23 12:06:21 作者: rapoo

求一个SQL查询语句
a表里面有2个字段

aa bb
1
2

b表里面有一个字段
aa
1
2
3
4

select aa from b where not in(select aa from a)

这样没有错,但是

select aa from b where not in(select bb from a)

这样就没有返回值了,,大家帮忙看看啊,


[解决办法]
null 是一个不确定的值.有时候会导致查询的结果不确定.
你可以这样:
select aa from b where not in(select isnull(bb, ' ') as col1 from a)


读书人网 >C#

热点推荐