The following solution is for getting 2nd highest salary from Employee table
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP 2 salary
FROM employee
ORDER BY salary DESC) Emp
ORDER BY salaryYou can change and use it for getting 3rd highest salary from Employee table as follows
SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP 3 salary
FROM employee
ORDER BY salary DESC) Emp
ORDER BY salary
so you can find nth highest salary also using same query.

Join the conversation! Your thoughts help the community grow.