Update with use of subquery
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