Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Update from a subquery
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