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

Home -> Community -> Usenet -> c.d.o.server -> Re: Update from a subquery

Re: Update from a subquery

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Wed, 25 Aug 2004 23:06:55 -0700
Message-ID: <1093500467.228801@yasure>


hedrew3 wrote:

> Hello all --
>
> Can't figure out why this doesn't work, and/or how to make it work:
>
> I have two tables X (columns A, B, and C), and Y (columns D, E, F,
> ...).
> I am trying to update columns B and C with the minimum values of E and
> F; the join is on columns A and D.
>
> So, I try:
>
> update X
> set (A, B, C) = (
> select D, min(E), min(F)
> from Y
> group by D
> ) Y1
> where X.A = Y1.D
>
> BTW, I don't need to update the value of A, but I don't know if I can
> eliminate that either.
>
> TIA
>
> Pete

Did you try?

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Thu Aug 26 2004 - 01:06:55 CDT

Original text of this message

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