-
Hi,
we are trying to copy 2 columns from one table to another. we were trying to use update statement to achieve this task, but we are not able to find correct syntax.
eg:
table 1 table2
key1 key2
col1 colA
col2 colB
We would like to update table1 with values of colA & colB from table2 where key1 is equal to key2. Any help on this query is appericated.
thank you
-
Try this, I think it'll work:
update table1
set table1.colA=table2.colA, table1.colB=table2.colB where
key1=key2;
-
Halo, it won't work.
The workable statement is:
UPDATE TABLE1 A SET (A.COL2, A.COL3) =
(SELECT B.COL2, B.COL3 FROM TABLE2 B WHERE A.KEY1=B.KEY2);
-