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

SQL查询语句

2012-03-23 
求一个SQL查询语句a表里面有2个字段aabb12b表里面有一个字段aa1234selectaafrombwherenotin(selectaafroma

求一个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)


热点排行