|
|
|
|
|
|
|
Re: how to find nth maximum salary from a table [message #334254 is a reply to message #334247] |
Wed, 16 July 2008 00:10   |
wangfans
Messages: 7 Registered: July 2008 Location: PRC
|
Junior Member |
|
|
SQL> select * from test
2 ;
COL1 COL2
---------- --------------------
22 FF
24 DD
19 WANGFAN
1 a
3 a
5 a
6 b
7 b
8 c
9 c
10 rows selected.
SQL> select * from(select col1,col2 , rank()over(order by col1)rn from test) where rn=2;
COL1 COL2 RN
---------- -------------------- ----------
3 a 2
SQL> select * from(select col1,col2 , rank()over(order by col1)rn from test) where rn=9;
COL1 COL2 RN
---------- -------------------- ----------
22 FF 9
|
|
|
|
|