How can I do an UPDATE statement with JOIN in SQL Server?


I need to update this table in SQL Server with data from its 'parent' table, see below:

Table: sale

id (int)
udid (int)
assid (int)



Table: ud

id (int)
assid (int)


sale.assid contains the correct value to update ud.assid.



Yes, it is possible to do an UPDATE statement with JOIN in SQL server. The JOIN clauses can be used in the UPDATE statement to perform a cross table update.

Below is the syntax of the  UPDATE JOIN clause:




    table1.col1 = table2.col2,

    table1.col2 = expression,




    [INNER | LEFT] JOIN table2 ON join_predicate




If you want to unleash your potential in this competitive field, please visit the SQL course page for more information, where you can find the SQL tutorials and SQL frequently asked interview questions and answers as well.


This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.