或直接查询: Select * from A表 a left join B表 b on a.a = b.a and a.b = b.b where b.a is null and b.b is null
select a.* from a left join b on a.a=b.a and a.b=b.b where b.a is null and b.b is null
或: select * from a where not exists(select 1 from b where a.a=b.a and a.b=b.b)
Select a.* from A表 a left join B表 b on a.a = b.a and a.b = b.b where b.a is null and b.b is null
delete a from A表 a,B表 b where a.a = b.a and a.b = b.b
select a.* from A where convert(varchar, a) + ' ' + convert(varchar, b) not in (select convert(varchar, a) + ' ' + convert( varchar, b) from b)
select a.* from a left outer join b on a.a=b.a and a.b=b.b where b.a is null and b.b is null
Select a.* from A表 a left join B表 b on a.a = b.a and a.b = b.b where b.a is null and b.b is null
select * from a where a not in(select a.a from a inner join b on a.a=b.a and a.b=b.b) and b not in (select a.a from a inner join b on a.a=b.a and a.b=b.b)
刚才发错了 select * from a where a not in(select a.a from a inner join b on a.a=b.a and a.b=b.b) and b not in (select a.b from b inner join b on a.a=b.a and a.b=b.b)
delete a from A表 a join B表 b on a.a = b.a and a.b = b.b
select * from A表 where (A表.a<>B表.a and A表.b<>B表.B)
Select * from A表 a
left join B表 b on a.a = b.a and a.b = b.b
where b.a is null and b.b is null
left join b on a.a=b.a and a.b=b.b
where b.a is null and b.b is null
select * from a where not exists(select 1 from b where a.a=b.a and a.b=b.b)
left join B表 b on a.a = b.a and a.b = b.b
where b.a is null and b.b is null
select a.* from A where convert(varchar, a) + ' ' +
convert(varchar, b) not in (select convert(varchar, a)
+ ' ' + convert( varchar, b) from b)
left outer join b on a.a=b.a and a.b=b.b
where b.a is null and b.b is null
left join B表 b on a.a = b.a and a.b = b.b
where b.a is null and b.b is null
select * from a where a not in(select a.a from a inner join b on a.a=b.a and a.b=b.b) and b not in (select a.b from b inner join b on a.a=b.a and a.b=b.b)
from A表 a
join B表 b on a.a = b.a and a.b = b.b