SQL 將一個表中字段的值複製到另外一個表的字段中

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

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

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

示例:select

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

相關文章
相關標籤/搜索