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

前端 未结 16 1286
名媛妹妹
名媛妹妹 2020-11-21 11:51

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

Table: sale

id (int)
udid         


        
16条回答
  •  臣服心动
    2020-11-21 12:21

    I was thinking the SQL-Server one in the top post would work for Sybase since they are both T-SQL but unfortunately not.

    For Sybase I found the update needs to be on the table itself not the alias:

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

提交回复
热议问题