Hi all,
I need to update field three of first table with field three of second
tables for all records that match field one of first table with field
one of second table (both are primary key for each table and are same).
I need to write an ANSI sql query to do this job.
I tried follwing , but it didn't work.
update tab1 set t1.c=t2.c from tab1 t1,tab2 t2 where t1.a=t2.a;
testdb=# \d tab1
Table "public.tab 1"
Column | Type | Modifiers
--------+---------+-----------
a | integer |
b | integer |
c | integer |
testdb=# \d tab3
Table "public.tab 3"
Column | Type | Modifiers
--------+---------+-----------
a | integer |
b | integer |
c | integer |
Pl. do reply me.
I need to update field three of first table with field three of second
tables for all records that match field one of first table with field
one of second table (both are primary key for each table and are same).
I need to write an ANSI sql query to do this job.
I tried follwing , but it didn't work.
update tab1 set t1.c=t2.c from tab1 t1,tab2 t2 where t1.a=t2.a;
testdb=# \d tab1
Table "public.tab 1"
Column | Type | Modifiers
--------+---------+-----------
a | integer |
b | integer |
c | integer |
testdb=# \d tab3
Table "public.tab 3"
Column | Type | Modifiers
--------+---------+-----------
a | integer |
b | integer |
c | integer |
Pl. do reply me.
Comment