views:

24

answers:

1

hi

i have 2 tables

table1: num,X,Y

table2: num,X,Y

i need to update X and Y in table1 where table1.num = table2.num

how to do it ?

i need it in Oracle query (i think that in sql server it will work too)

thank's in advance

+5  A: 

FOR oracle:

 UPDATE table1 t1
 SET (x,Y) = (SELECT x, y from table2
             WHERE t1.num = t2.num)

FOR mssql:

 UPDATE t1
 SET x = t2.x,
     y = t2.y
 FROM table1 t1, table2 t2
 WHERE t1.num = t2.num
Michael Pakhantsov
thank's !!!! it works !!!!!
Gold