select min(salary) as high5
from employee
where salary in (select distinct top 5 salary
from employee
order by salary
desc )
--
select sal from ( select sal,dense_rank() over(order by sal desc ) dr from emp ) where dr = 5 and rownum = 1
--
select sal from (select rownum rn,b.sal from ( select unique sal from emp a order by sal desc) b) where rn=5
---
Find second highest salary
select max(salary)
from employee
where salary not in(select max(salary) from employee)
No comments:
Post a Comment