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 wrote:
> Hi,
> 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;
>
> I can't seem to figure out how to combine the two in one query (or
> nested sub-queries). Is it possible at all? If not, what would be the
> best way, in your opinion, to do this?
>
I think the following will work for you.
UPDATE a
SET a.somefield = (SELECT b.somefield
FROM b WHERE b.id = a.id)WHERE a.id in ('<a list of values>');
Worked for me.
===--->derek Received on Fri Sep 19 1997 - 00:00:00 CDT
![]() |
![]() |