Update a table with join?

前端 未结 4 2080
栀梦
栀梦 2020-12-03 16:20

I am trying to update table A with data from table B. I thought I can do something like this

update A 
set A.DISCOUNT = 3 
from INVOICE_ITEMS A
join ITEM_PRI         


        
4条回答
  •  独厮守ぢ
    2020-12-03 16:56

    You might be getting error because of the FROM clause .You can do it without using FROM clause. Here is an example :

        UPDATE customer_table c 
    
          JOIN  
              employee_table e
              ON c.city_id = e.city_id  
          JOIN 
              anyother_ table a
              ON a.someID = e.someID
    
        SET c.active = "Yes"
    
        WHERE c.city = "New york";
    

提交回复
热议问题