Answer the question
In order to leave comments, you need to log in
How to write the result of a selection with inner join to a table column?
Hello, I already asked a similar question when I wanted to transfer data from one table to another using update, then it gave such an error
update contract_city
set manager_id =
(select manager_id
from contract_manager
where contract_manager.contract_id = contract_city.contract_id)
(select contract_manager.manager_id
from contract_manager
inner join contract_city
on contract_manager.contract_id = contract_city.contract_id)
update contract_city
set manager_id =
(select contract_manager.manager_id
from contract_manager
inner join contract_city
on contract_manager.contract_id = contract_city.contract_id)
Answer the question
In order to leave comments, you need to log in
use merge and rowid
merge into target t
using
( with update_list as
(select t.rowid rid, sn, ts, ss should_be_s
from target t, source s
where tn = sn
and ss != ts)
select u.* from update_list u
) x
on (t.rowid = x.rid)
when matched
then
update set ts = x.should_be_s
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question