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 >
精彩评论