select b.* from b left join a on b.字段1=a.字段1 and b.字段2=a.字段2....
where a.任一字段 is null
b.字段1=a.字段1 and b.字段2=a.字段2....   --这是确认是子集的条件

解决方案 »

  1.   


    差:
    c1-c2:select * from t1 where not exists(select 1 from t2 where t1.c1=t2.c1 and t1.c2=t2.c2)c2-c1:select * from t2 where not exists(select 1 from t1 where t1.c1=t2.c1 and t1.c2=t2.c2)
      

  2.   

    select * from b where 主键 not in (select 主键 from a)或:差:
    c1-c2:select * from t1 where not exists(select 1 from t2 where t1.c1=t2.c1 and t1.c2=t2.c2)c2-c1:select * from t2 where not exists(select 1 from t1 where t1.c1=t2.c1 and t1.c2=t2.c2)
      

  3.   

    是关系的差运算:
    select * from b where not exists(select 1 from a where b.c1=a.c1 and b.c2=a.c2)
      

  4.   

    select * from b where 主键 not in (select 主键 from a)