Friday, 8 April 2011

SQL query to find out any nth highest salary


select b.Salary
from (select distinct Salary from employees) a,
(select distinct Salary from employees) b
where a.Salary>=b.Salary
group by b.Salary having count(b.Salary)=1

No comments:

Post a Comment