Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: *PLEASE* Help with an UPDATE query...Thanks
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.
![]() |
![]() |