Saturday, November 27, 2010

MSSQL - How to execute UPDATE with JOIN

UPDATE Table1
SET Table1field1 = 'somevalue', Table1field2 = 'somevalue'
FROM Table1 AS t1
INNER JOIN Table2 AS t2 ON t1.id = t2.ref_id
WHERE t1.Table1field1 = 'test' AND t2.Table2field1 = 'test'
    

No comments:

Post a Comment