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、写入后的效果



原文地址:https://www.cnblogs.com/guxingy/p/13175460.html