首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > PowerDesigner >

[转帖]update 更新表中多条记要。从另一个表中调用记录

2012-07-03 
[转帖]update 更新表中多条记录。从另一个表中调用记录。我的应用:创建主表:update tbA set a3a3+B.b3 from

[转帖]update 更新表中多条记录。从另一个表中调用记录。

我的应用:

创建主表:

update tbA set a3=a3+B.b3 from (select b1,b3 FROM tbB) B where a1 in ( B.b1)----------------------------------------------use northwindGOcreate table tem_1( names char(10),number int )declare @num intset @num = 1while @num <10begin insert into tem_1 values ('chen' ,@num)set @num=@num+1endselect * from tem_1create table tem_2( names char(10),number int )declare @num intset @num = 10while @num <20begin insert into tem_2 values ('MAckson' ,@num)set @num=@num+1endselect * from tem_2update tem_1  set names = B.names from tem_1 as A,tem_2 as B where A.number <10 Drop tem_1Drop tem_2 Go

热点排行