I have table1
and table2
. They have the same columns and the column ID
is the one that i can use to connect the tables.
How can i run foreach statment that will update row Name
in table1
with the value for column Name
in table2
?
I need this so i can fix the column Name
in Table1
because it is incorect , and the good values for it are in table2
I tried using a single update statement but it takes forever to execute because both tables are with over 600 000 rows
update
table1 t1
set
(
t1.name
) = (
select
t2.name
from
table2 t2
where
t2.id = t1.id
and
rownum = 1
)
where exists (
select
null
from
table2 t2
where
t2.id = t1.id
);