Oracle SQL update based on subquery between two tables

后端 未结 4 666
無奈伤痛
無奈伤痛 2020-12-31 11:51

I am currently writing update statements to keep a query-able table constantly up to date. The schema is identical between both tables and the contents are not important:

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 12:08

    Without examples of the dataset of staging this is a shot in the dark, but have you tried something like this?

    update PRODUCTION p,
           staging s
    set p.name = s.name  
        p.count = s.count
    where p.id = s.id
    

    This would work assuming the id column matches on both tables.

提交回复
热议问题