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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM