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

一: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

示例:

update SMT_ProductPos
set SMT_ProductPos.Posnumber=Bak from bom_BillListTab
where SMT_ProductPos.ParentProduct=bom_BillListTab.ParentProduct and SMT_ProductPos.Productid=bom_BillListTab.ProductId

原文地址:https://www.cnblogs.com/yc-shen/p/10893972.html