日期:2014-05-18 浏览次数:20597 次
--> 测试数据:[A1]
if object_id('[A1]') is not null drop table [A1]
create table [A1]([a] int,[b] int,[c] int)
insert [A1]
select 1,2,3 union all
select 1,2,2
--> 测试数据:[B2]
if object_id('[B2]') is not null drop table [B2]
create table [B2]([a] int,[b] int,[c] int)
insert [B2]
select 1,2,3 union all
select 1,1,1 union all
select 1,1,2
delete from [A1] where exists (select 1 from [B2]
WHERE [A1].a=[B2].a and [A1].b=[B2].b and [A1].c=[B2].c)
select*from[A1]
/*
a b c
1 2 2
*/
------解决方案--------------------