sql server update select join code example
Example 1: update with join sql server
UPDATE
t1
SET
t1.c1 = t2.c2,
t1.c2 = expression,
...
FROM
t1
[INNER | LEFT] JOIN t2 ON join_predicate
WHERE
where_predicate;
Example 2: update from select join
UPDATE t1
SET t1.COL1 = t2.COL1, t1.COL2 = t2.COL2
FROM my_table AS t1
JOIN my_other_table AS t2 ON t1.COLID = t2.ID
WHERE t1.COL3 = 'OK';