EMPNO SALARY
1 100
2 200
3 300
4 400
5 500
6 500
7 700
With rownum you get 500 once, and you don't know which empno.
Printable View
EMPNO SALARY
1 100
2 200
3 300
4 400
5 500
6 500
7 700
With rownum you get 500 once, and you don't know which empno.
OK, but the original question doesn't mention empno at all ...
Hi
This will also work
select distinct a.sal from emp a
where 5>=(select count(distinct sal) from emp b where b.sal >=a.sal)
order by a.sal desc
just in place of 5 put what u want the top n salaries
cheers
sarath d