Update a table with join?

前端 未结 4 2092
栀梦
栀梦 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:59

    you can use like this :

    update INVOICE_ITEMS  
    set DISCOUNT = 3 
    from (select * from ITEM_PRICE_QUNTITY ) b
    where INVOICE_ITEMS.ITEM_PRICE_NO = B.ID and 
    INVOICE_ITEMS.INVOICE_ID = 33
    

提交回复
热议问题