SQL Server 将一个表中字段的值复制到另一个表的字段中

具体方法如下

一:update 表2 set (要插入的列名)= select 表1.某一列 from 表1 left jion 表2 on 表1和表2的关联 where .....  

二:update 表1 set 表1.列=表2.列 from 表2 where 表2.id=表1.id 

三:update _a set 列=_b.列 from 表1 _a join 表2 _b on _a.id=_b.id

猜你喜欢

转载自www.cnblogs.com/zcp-/p/9480380.html