Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: *PLEASE* Help with an UPDATE query...Thanks

Re: *PLEASE* Help with an UPDATE query...Thanks

From: Dan Clamage <dclamage_at_idcomm.com>
Date: 1997/09/20
Message-ID: <01bcc553$93027320$b5240dd0@djchome>#1/1

NNOOR <Nnoor_at_cris.com> wrote in article
<5vuchv$s6o_at_examiner.concentric.net>...
> I have two tables--call them A and B.
> I want to update certain fields in A from values in table B based
> on a selection criteria.
> The "select" portion would be like:
> SELECT * from A
> WHERE A.ID = B.ID AND A.ID in ('<a list of values>');
> And then based on above select, I want to update table A:
> UPDATE A
> SET A.someField = B.someField;

Try something on the order of:
UPDATE A
SET A.someField = (SELECT B.someField FROM B

                              WHERE B.id = A.id)
WHERE A.id IN (<list of values>);

Note that B.id = A.id better be a unique row or this won't work. And you must qualify all column references with the table, as shown.

Received on Sat Sep 20 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US