Get nth highest salary of an employee in sql server table

Karthikanbarasan
Posted by Karthikanbarasan under Sql Server category on | Points: 40 | Views : 3587
Example : this query gets the 6th highest salary of the employee

SELECT TOP 1 EMPSalary
FROM (
SELECT DISTINCT TOP 6 EMPSalary
FROM employeemaster
ORDER BY EMPSalary DESC) a
ORDER BY EMPSalary

Comments or Responses

Login to post response