A表
AreaMedian,LocationMedian,Name
001          1000           2
001          1001           2B表
AreaMedian,LocationMedian
001          1000结果为
001          1001 
查询A表中没有B表中的数据B表中存在的数据不显示?

解决方案 »

  1.   

    select AreaMedian,LocationMedian from A
    except
    select AreaMedian,LocationMedian from B
      

  2.   

    select t1.AreaMedian,t1.LocationMedian from t_A t1
    left join t_B t2
    on t1.AreaMedian = t2.AreaMedian
    where t1.LocationMedian <> t2.LocationMedian
      

  3.   

    SELECT AreaMedian,LocationMedian FROM A
    MINUS
    SELECT AreaMedian,LocationMedian FROM B显示A中有B种没有的数据
      

  4.   

    select A.AreaMedian,A.LocationMedian from A where not exsits
    (select 1 from B where A.AreaMedian=B.AreaMedian and A.LocationMedian=B.LocationMedian)