04 March 2009

SQL : How to get 5th max salary from a table

select x.* from (

SELECT SALARY, EMP_ID, RANK() OVER(ORDER By Salary) AS MAX_SALARY FROM employee) X

WHERE X.Max_salary = 5

No comments: