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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Second Max

Re: Second Max

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Fri, 24 Sep 1999 11:10:05 +0200
Message-ID: <7sff6r$goa$1@oceanite.cybercable.fr>


Try this:

v734>create table t (col number);
v734>select * from t order by col;

       COL


         0
         0
         1
         1
         2
         2
         3
         3
         4
         4
         5
         5
         6
         6
         7
         7
         8
         8
         9
         9
        10
        10

22 rows selected.

To get the third max:

v734>select distinct col from t a
  2 where 3 = (select count(distinct col) from t b where b.col >= a.col)   3 /

       COL


         8

1 row selected.

V. Sundararaman a écrit dans le message ...
>Hello Oracle World,
>
>I would appreciate if anyone can give the SQL statement to find the Nth Max
>of a column in a table in an oracle database.
>
>Thanks
>Sundar
>
>
Received on Fri Sep 24 1999 - 04:10:05 CDT

Original text of this message

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