- 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)
- 结果:

生命不息,代码不止
浙公网安备 33010602011771号