How to find third or nth maximum salary from salary table(EmpID, EmpName, EmpSalary) in optimized way?
table(EmpID, EmpName, EmpSalary)
Select TOP 1 Salary as '3rd Highest Salary' from (SELECT DISTINCT TOP 3 Salary from Employee ORDER BY Salary DESC) a ORDER BY Salary ASC;
I am showing 3rd highest salary