|
-
If you want the 5 top employee ordered by salary
select * from (
select * from employee
order by salary desc
)
where rownum<=5
If you want all employees having the 5 top salaries
select * from employee
where salary in
(select salary from (
select distinct salary from employee
order by salary desc)
where rownum<=5)
OR
select * from (
select e.*,
dense_rank() over (order by salary desc) as dr
from employee e
)
where dr <=5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|