Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update with use of subquery

ittichaiApr 23 2002 — edited Jun 9 2005
I'd like to update all the rows with values getting from subquery from the same table.
For example, the subquery of

select id, some_manipulation as value from table_a
id value
-------------------
1 12
2 14
3 16
4 21

I'd like to use above info update the values of a column (column2 of table_a) according to the same id. Something like this

update table_a a
set a.column2 = b.value
where a.id =
(select b.id from table_a b);

I know above sql sytax is invalid, but I just want to give you an idea what I'm tryig to accomplish. Any idea?

Thanks in advance,
Ittichai
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 7 2005
Added on Apr 23 2002
16 comments
1,891 views