I got three tables:
t1.columns: a,c
t2.columns: a,b
t3.columns: b,c,d
Now what I want is to update t1.c with t3.d. But I can\'t just update t1
You have a subquery that is returning more than one row. Use rownum
to get just one row:
UPDATE table1 t1
SET t1.c = (select d
from (select t3.d
from table2 t2 join table3 t3
on t2.b = t3.b
where t1.a = t2.a
) t
where rownum = 1
)
WHERE EXISTS ( SELECT 1 FROM table2 t2, table3 t3 WHERE t1.c = t3.c and t1.a = t2.a);