SQL SERVER – Find Nth Highest Salary of Employee – Query to Retrieve the Nth Maximum value
How to get 1st, 2nd, 3rd, 4th, nth topmost salary from an Employee tableThe following solution is for getting 6th highest salary from Employee table ,SELECT TOP 1 salaryFROM (SELECT DISTINCT TOP 6 salaryFROM employeeORDER BY salary DESC) aORDER BY salaryYou can change and use it for getting nth highest salary from Employee table as followsSELECT TOP 1 salaryFROM (SELECT DISTINCT TOP n salaryFROM employeeORDER...