tableA :A,B,C字段
tableB: A,B 字段
要select 出tableA中a,b字段不同时等于tableB中a,b值的记录

解决方案 »

  1.   

    select A,B,C from tableA
    where not exists(select 1 from tableB where A=tableA.A and B=tableA.B)
      

  2.   

    select * from tableA
    where not in (select tableA.a,tableA.b,tableA.c from tableA ,tableB 
                  where  tableA.a=tableB.a and tableA.b=tableB.b)
      

  3.   

    还是用 not exists 比较好
      

  4.   

    select a.* from tableA  A inner join tableB b on a.a=b.a and a.b<>b.b or  a.a<>b.a and a.b=b.b
      

  5.   

    select A,B,C from tableA
    where not exists(select 1 from tableB where A=tableA.A and B=tableA.B)
    ...............就是这个了.
      

  6.   

    select *
    from tableA a
    where not exists(select 1 from tableB b where a.a=b.a and a.b=b.b)