2017年10月20日 星期五

[SQL Server]update join table

https://stackoverflow.com/questions/1293330/how-can-i-do-an-update-statement-with-join-in-sql

SQL Server:
update u
set u.assid = s.assid
from ud u
    inner join sale s on
        u.id = s.udid
Oracle:
update
    (select
        u.assid as new_assid,
        s.assid as old_assid
    from ud u
        inner join sale s on
            u.id = s.udid) up
set up.new_assid = up.old_assid