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