| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Second Max
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
![]() |
![]() |