Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Update table
miguel wrote:
>
> SQL question:
>
> Table test1 ( A,B,C,D,E,F) Table test2 (A,B,C,D)
>
> I want to update column C and D from "test1" where test1.A=test2.A and
> test1.B=test2.B and (test1.C<>test2.C or test1.D<>test2.D).
>
> Can someone help me?
> Tanks
HI,
UPDATE test1
SET
C=value_c,
D=Value_d
WHERE
test1.A in
(Select t1.A
from
test1 t1, test2 t2
where
t1.A=t2.A
and
t1.B=t2.B
and
(t1.C<>t2.C or t1.D<>t2.D))
Assuming A is unique in test1.
-- Regards M.Gresz :-)Received on Tue Oct 28 1997 - 00:00:00 CST