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

Technology CommunityCategory: SQLHow can I do an UPDATE statement with JOIN in SQL?
VietMX Staff asked 3 years ago
Problem

sale

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

ud

id  (int)
assid  (int)

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

What MS SQL query will do this? Could you do that without JOIN?

update u
set u.assid = s.assid
from ud u
    inner join sale s on
        u.id = s.udid

Without JOIN:

update ud 
set assid = sale.assid
from sale
where sale.udid = id