日期:2014-05-17 浏览次数:20438 次
create table A表(ID1 varchar(20), ID2 int)
insert into A表
select 'a', 1 union all
select 'a', 2 union all
select 'b', 1 union all
select 'b', 3
create table B表(ID1 varchar(20), ID2 int)
insert into B表
select 'a', 3 union all
select 'a', 1 union all
select 'b', 2 union all
select 'b', 3
go
insert into A表
select b.*
from B表 b
left join A表 a
on a.ID1 = b.ID1 and a.ID2 = b.ID2
where a.ID1 is null
go