SQL Server 多表关联的update语句


原文:https://blog.csdn.net/hgffhh/article/details/84192260



1、目的

把表node3的数据,写入到node1中,必须得是关联写入。

2、表



3、SQL

用id连

update node1
set FullName=node3.FullName
from node1,node3
where node1.Id=node3.Id

多字段连

update node1
set FullName=node3.FullName
from node1,node3
where node1.ParentId=node3.ParentId AND node1.[Level]=node3.[Level]

4、写入后的效果




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM