Normally people think UPDATE statement runs only for a single table but for scenario when we have to check multiple values in a multiple table then we cannot use update statement. Well folks it’s just a myth & we can use it while joining multiple tables.
Please check given below sample query to update the records while joining multiple tables
UPDATE
T
SET
T.col1 = OT.col1,
T.col2 = OT.col2
FROM
Some_Table T
INNER JOIN
Other_Table OT
ON
T.id = OT.id
WHERE
T.col3 = 'some value'
Hopefully it will work for you. Cheers

0 comments:
Post a Comment