mssql update from select inner join Edit

Murugan Andezuthu Dharmaratnam | 23 September 2020 | 671

MSSQL query to update a table by joining from another table. In this below sample there are two tables TableA and TableB and you want to update TableA by joining two tables.

SQL Query

UPDATE
    TableA
SET
    TableA.col1 = TableB.col1,
    TableA.col2 = TableB.col2
FROM
    TableA
    INNER JOIN TableB
        ON TableA.id = TableB.id
WHERE
    TableA.col3 = 'something'