SQL – Joined Update – Table update With A Join

 

The following joined update updates a table called data.dbo.table1 from a table called data.dbo.table2 and sets the fielda in table1 equal to fielda in table2 based on a matching ref:

updatedata.dbo.table1

      setfielda = b.fielda

fromdata.dbo.table1 as a

joindata.dbo.table2 as b

on a.ref = b.ref

Advertisements