T-SQL: How to update a table using an INNER JOIN

Hi folks,

This is an annotation to not forget how to do this on T-SQL that I’m sharing with you.

Could be possible that you want to update a table in T-SQL but only for a subset of records matching another table you want to join with.

So… Here’s an example for this:


  SET tableA.yourfield = value 
  FROM tableA AS a INNER JOIN tableB AS b 
  ON a.id=b.id