|
Re: n th maximum salary from emp table [message #82096 is a reply to message #82095] |
Tue, 22 April 2003 13:28 |
Julie
Messages: 98 Registered: February 2002
|
Member |
|
|
I don't know if this is the standard answer, because I just made it up, but to select the 9th highest salary:
SELECT min(salary)
FROM (SELECT salary FROM emp ORDER BY salary DESC)
where rownum < 10
|
|
|
Re: n th maximum salary from emp table [message #82100 is a reply to message #82095] |
Tue, 22 April 2003 22:19 |
AM
Messages: 10 Registered: November 2001
|
Junior Member |
|
|
Try This:-
select sal from emp a
where &count=(select count(distinct sal) from emp b
where a.sal<=b.sal)
Count is the nth position you want to see.
If you make : -
select sal from emp a
where &count<=(select count(distinct sal) from emp b
where a.sal<=b.sal)
Then you can find lowest to nth position.
You can also try more combinations to the same.
|
|
|