有两个表他们的字段都是一样的,要求如果表1中的列A等于表2中列A,那就删除这个记录,例子如下
表1
列名 A B C
2 3 2
1 4 8
7 6 4表2
列名 A B C
2 3 2
1 4 8
转换后
表1
列名 A B C
7 6 4表2
列名 A B C
2 3 2
1 4 8
表1
列名 A B C
2 3 2
1 4 8
7 6 4表2
列名 A B C
2 3 2
1 4 8
转换后
表1
列名 A B C
7 6 4表2
列名 A B C
2 3 2
1 4 8
insert @tb1
select 2,3,2 union
select 1,4,8 union
select 7,6,4declare @tb2 table(A int,B int,C int)
insert @tb2
select 2,3,2 union
select 1,4,8delete @tb1 from @tb1 a,@tb2 b where a.A=b.Aselect * from @tb1select * from @tb2
delete from 表1 where 表1.A in (select 表1.A from 表1,表2 where 表1.A=表2.A)
服务器: 消息 107,级别 16,状态 3,行 1
列前缀 '表2' 与查询中所用的表名或别名不匹配。