--正確SQLupdate a set a.latesprice = (select b.amount from t_temp b where b.conNo = a.conNumber) where a.conNumber in (select b.conNo from t_temp b ) ;--測試資料 臨時表 create table temp_x as select
1 as c_id, 1.1 as c_amount from dual union all select
2 as c_id, 1.2 as c_amount from dual ; create table temp_y as select 1 as c_id, 1.43 as c_amount from dual union all select 2 as c_id, 1.44 as c_amount from dual ;--測試更新語句update temp_x a set a.c_amount = (select b.c_amount from temp_y b where b.c_id = a.c_id) where a.c_id in (select b.c_id from temp_y b) ; --查詢更新結果 select * from temp_x
--正確SQLupdate a set a.latesprice = (select b.amount from t_temp b where b.conNo = a.conNumber) where a.conNumber in (select b.conNo from t_temp b ) ;--測試資料 臨時表 create table temp_x as select
1 as c_id, 1.1 as c_amount from dual union all select
2 as c_id, 1.2 as c_amount from dual ; create table temp_y as select 1 as c_id, 1.43 as c_amount from dual union all select 2 as c_id, 1.44 as c_amount from dual ;--測試更新語句update temp_x a set a.c_amount = (select b.c_amount from temp_y b where b.c_id = a.c_id) where a.c_id in (select b.c_id from temp_y b) ; --查詢更新結果 select * from temp_x