Update and from
From: John Dennis <jdennis_at_netcom.com>
Date: Wed, 12 Jan 1994 19:28:51 GMT
Message-ID: <jdennisCJJ7G4.4zJ_at_netcom.com>
Date: Wed, 12 Jan 1994 19:28:51 GMT
Message-ID: <jdennisCJJ7G4.4zJ_at_netcom.com>
I'm a Sybase person out of his element. I'm trying to update a
table where the same key exists in another, identical table. Not
to push Sybase in this town but it does allow the "FROM" clause in
an UPDATE. For example, I have two tables, TABLE1 and TABLE2 which
have the columns KEY, A and B. Now I want to put TABLE1's A and B
values into TABLE2 WHERE TABLE1.KEY = TABLE2.KEY. It doesn't seem
obvious how I can do this (in Oracle). In Sybase I'd use:
UPDATE TABLE2
So, Oracle SQL experts, what is the clear (foggy to me) way to do
this?
Thanks in advance,
FROM TABLE1 T1,
TABLE2 T2
SET T2.A = T1.A,
T2.B = T1.A
WHERE T1.KEY = T2.KEY