晨小猿
Hello Word.
  • 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)

  • 结果:

    

 

posted on 2017-12-22 17:40  晨小猿  阅读(16662)  评论(0编辑  收藏  举报