Re: First two maximum and minimum value
Date: Mon, 22 Jul 2002 15:33:03 GMT
Message-ID: <3D3C246D.CBF495C0_at_shaw.caX>
or use the analytic function RANK to determine the Top N values etc. if you are using 8.1.x
check out asktom.oracle.com for more on the implementation of analytic functions.
> JC wrote:
>
> Try something like this :
>
> SELECT
> MAXIMUM.NAME
> FROM
> (
> SELECT
> NAME
> FROM
> EMP
> ORDER BY
> SALARY ASC
> ) MAXIMUM
> WHERE
> ROWNUM <= 2
>
> UNION ALL
>
> SELECT
> MINIMUM.NAME
> FROM
> (
> SELECT
> NAME
> FROM
> EMP
> ORDER BY
> SALARY DESC
> ) MINIMUM
> WHERE
> ROWNUM <= 2
>
> JC
>
> "Leader" <sohelcsc_at_yahoo.com> wrote in message
> news:b1a93c73.0207200516.57fe8f94_at_posting.google.com...
> > Hi All,
> >
> > I have a table(suppose emp table) From there i need to select First
> > two persons salary who get maximum salary. and two persons salary
who
> > get minimum salary.
> > Can anyone pls help me..
> >
> >
> > Thanks
> > hoque
-- -- remove the X from my email to respond -- a necessary evil to prevent more spamReceived on Mon Jul 22 2002 - 17:33:03 CEST