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: Is this possible in SQL?

Re: Is this possible in SQL?

From: Dr. Steffen Zgodzaj <steffen.zgodzaj_at_snafu.de>
Date: Sat, 20 Jul 2002 23:04:39 +0200
Message-ID: <3D39D067.5090704@snafu.de>


Hi Joe,

I`va no databasa available now to check but try this:

select x,y from A, (select min(z) z, y from A group by z) B where A.z = B.z and A.y = B.y;

Regards,
Steffen

Joe Imbrogo wrote:

> Let us assume there is a view A with data as follows...
>
> X Y Z
> -----------------------
> 12 2 2
> 14 2 3
> 17 2 9
> 19 3 12
> 21 3 16
> 25 4 21
>
> I need get the value of X for every unique value of Y, where Z is the
> lowest in its range.
>
> For example, the result for the above example would be
>
> X Y
> -------------
> 12 2
> 19 3
> 25 4
>
> I know this is very easy to do in PL/SQL, but I wanted to take up the
> challenge of doing this is a regular SQL statment. However, I could
> not make much progress.
>
> Any help on this would be greatly appreciated.
>
> Thanks,
> Joe
>
Received on Sat Jul 20 2002 - 16:04:39 CDT

Original text of this message

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