各位好!    刚遇到一个复杂的问题,求教大家了。    先举例说明:a 表的信息id    number
1    5
2    6
3    7
4    8b 表的信息
id    number
1    5
2    9
3    10
4    11希望得到的结果是:
id    nuber
1      9
2      10
3      11以上是例字说明
文字说明
我有两个表,A、B两表,字段一个,ID是自增,number是不同的数字。
B表匹配A表,去掉重复的信息,A、B两表重复的信息去掉,A表,没有重复的信息去掉,只留下B表没有重复的信息。以查询语句查询出来,请大家指教了,正确的以高分送给。在此谢谢大家了!

解决方案 »

  1.   

    select * from B where number not in(select number from A)
      

  2.   

    select *  from b  where bumber not in (select number  from a)
      

  3.   

    多谢xys_777、 xuam两位,你们两个答案一样,也是解决的方法
      

  4.   

    select b.id,b.number from b with(nolock) where b.number not in(select a.number from a with(nolock)