Update and left outer join statements

前端 未结 5 938
被撕碎了的回忆
被撕碎了的回忆 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-06 23:58

    If what you need is UPDATE from SELECT statement you can do something like this:

    UPDATE suppliers    
    SET city = (SELECT customers.city FROM customers
    
    WHERE customers.customer_name = suppliers.supplier_name)
    

提交回复
热议问题