I have tried this
gforge=> UPDATE data_table
gforge->SET field2_new=(SELECT new_id FROM mapping_table WHERE
old_id= data_table.field2_old);
and
gforge-> update data_table set field2_new_=mt.new_id FROM data_table dt,
mapping_table mt WHERE dt.field2_old=mt.old_id;
but initially I got error.
Venelin Arnaudov wrote:
Hi
I want to update the values of one column of a table based on the
matches in a second table
something like
update table1
set table1.field2_new=table2.new_id
from table2
where table1.field2_old=table2.old_id;
Did you try it?
http://www.postgresql.org/docs/8.2/s
Hi
I want to update the values of one column of a table based on the
matches in a second table
data_table:
field1,
field2_new,
...
field2_old
mapping_table:
new_id,
old_id
something like
update table1
set table1.field2_new=table2.new_id
from table2
where table1.field2_old=table2.