select a,b from table1 left join table2 on table1.a = table2.c and table1.b = table2.d where table2.c is null
select a,b from table1 left join table2 on table1.a = table2.c and table1.b = table2.d where table2.c is null
用一个函数把两个字段合并成一个字段。比如select * from Table1 where convert(varchar(100),A)+convert(varchar(100),B) not in(select convert(varchar(100),C)+convert(varchar(100),D) from Table2) 这样应该是可以实现,但方法很笨,抛装引玉。
select A, B from table1 where not exists (select C, D from table2 where table1.A = table2.C and table1.B = table2.D)
select A, B from table1 where not exists (select C, D from table2 where table1.A = table2.C and table1.B = table2.D)
select A,B from table1 where not exists (select C,D from table2 where table1.A=table2.C and table1.B=table2.D) as mm
from table1 left join table2
on table1.a = table2.c and table1.b = table2.d
where table2.c is null
from table1 left join table2
on table1.a = table2.c and table1.b = table2.d
where table2.c is null
where convert(varchar(100),A)+convert(varchar(100),B)
not in(select convert(varchar(100),C)+convert(varchar(100),D) from Table2) 这样应该是可以实现,但方法很笨,抛装引玉。
(select C, D from table2 where table1.A = table2.C and
table1.B = table2.D)
(select C, D from table2 where table1.A = table2.C and
table1.B = table2.D)
from table1
where not exists (select C,D from table2 where table1.A=table2.C and table1.B=table2.D) as mm