Top five salaries from emp [message #768] |
Sun, 03 March 2002 23:05 |
Daman
Messages: 4 Registered: March 2002
|
Junior Member |
|
|
I want to display top five salaries from emp table without using max and count as well as subqueries.
i want to use rownum.
|
|
|
|
|
Re: Top five salaries from emp [message #829 is a reply to message #768] |
Wed, 06 March 2002 13:21 |
Mike
Messages: 417 Registered: September 1998
|
Senior Member |
|
|
The fastest way to do this with Oracle 8.1.6 (or later) is:
select ename, sal from
( select ename, sal,
dense_rank() over(order by sal asc) as sal_rank
from scott.emp
)
where sal_rank < 6
|
|
|