update #表BBB set #表BBB.EE=#表AAA.EE from #表AAA where #表BBB.CC=#表AAA.CC and #表BBB.DD=#表AAA.DD and #表BBB.EE=999
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
drop table #表AAA
drop table #表bbb
GO
create table #表AAA(AA varchar(10),BB varchar(10),CC varchar(10),DD varchar(10),EE INT)
create table #表BBB(AA varchar(10),BB varchar(10),CC varchar(10),DD varchar(10),EE INT)
insert into #表BBB
select '0001','0011','0111','1111',999 union all
select '0002','0022','0222','2222',99 union all
select '0003','0033','0333','3333',999 union all
select '0004','0044','0444','4444',999
insert into #表AAA
select '0001','0011','0111','1111',1111 union all
select '0002','0022','0222','2222',2222 union all
select '0003','0033','0333','3333',3333 union all
select '0004','0044','4444','4444',4444
select * from #表bbb
update #表BBB set #表BBB.EE=#表AAA.EE from #表AAA where #表BBB.CC=#表AAA.CC and #表BBB.DD=#表AAA.DD and #表BBB.EE=999
select * from #表bbb
[此贴子已经被作者于2016-9-2 08:58编辑过]