开发者

SQL Server 2008: update query

开发者 https://www.devze.com 2023-02-15 16:50 出处:网络
I have TableA with FKColumnID I also have TableB 开发者_运维百科with ColumnID and ColumnName How can I update TableA.FKColumnID to have the same value as tableB.ColumnName?

I have TableA with FKColumnID

I also have TableB 开发者_运维百科with ColumnID and ColumnName

How can I update TableA.FKColumnID to have the same value as tableB.ColumnName?

Update TableA
Set TableA.ColumnName = TableB.ColumnName


You can try this

UPDATE TableA
SET ColumnName = TableB.ColumnName
FROM TableA
JOIN TableB on TableA.FKColumnID = TableB.ColumnID
WHERE < any additional criteria >
0

精彩评论

暂无评论...
验证码 换一张
取 消