• A表数据

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

  • B表数据

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

  • 现在要把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)

  • 结果:

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

05-20 19:35