开发者

SQL Server 2008: update query

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜