日期:2014-05-17 浏览次数:20628 次
update 表2 set partspri =表1.jiage from 表1 where 表1.bianma = 表2.partsnum
------解决方案--------------------
create table #a (bianma varchar(20),jiage int ) create table #b(Partsnum varchar(20),Partspri int) --drop table #b --drop table #a insert into #a select '111AADDD',111 UNION ALL select '222ffg',21 UNION ALL select '3434ffggg',34 insert into #b select '111AADDD',0 UNION ALL select '1222dfdf',0 UNION ALL select '2d232323',0 select * from #a select * from #b update b set b.Partspri=a.jiage from #a a,#b b where a.bianma=b.partsnum --结果: Partsnum Partspri 111AADDD 111 1222dfdf 0 2d232323 0