求 oracle 从一个表中取出数据作为参数 修改另一个表的sql语句

如题所述

第1个回答  2020-01-15
有两种情况:
1.查询a表结果,作为更新b表的条件;
update
table_b
set
col_1
=
'123'
where
col_2
in
(select
col_22
from
table_a
where
...);
2.查询a表结果,用来更新b表指定条件
update
table_b
set
col_1
=
(select
col_11
from
table_a
where
col_22
=
table_b.col_2)
where
...
不知道你是哪种,套用这个试试。如果情况复杂,请追问,列出表结果,说明操作要求。
相似回答