Update and left outer join statements

前端 未结 5 991
被撕碎了的回忆
被撕碎了的回忆 2021-02-06 23:45

I have two tabels with a relation and I want to update a field in table A. Is it possible to combine update and join in the same query? I googled it but didnt find any working s

5条回答
  •  没有蜡笔的小新
    2021-02-07 00:14

    Just another example where the value of a column from table 1 is inserted into a column in table 2:

    UPDATE  Address
    SET     Phone1 = sp.Phone
    FROM    Address ad LEFT JOIN Speaker sp
    ON      sp.AddressID = ad.ID
    WHERE   sp.Phone <> '' 
    

提交回复
热议问题