Oracle 一个表的数据update到另一个表

  • A表数据

    

  • B表数据

          

  • 现在要把B表 B_COSTS 的值update到A表 A_COSTS 字段
  • SQL语法:

      update a set (a.a_costs) = (select b.b_costs from b where a.id = b.id and a.a_id = b.b_id) where exists
                      (select 1 from b where a.id = b.id and a.a_id = b.b_id)

  • 结果:

    

原文地址:https://www.cnblogs.com/txsblog/p/8087077.html