
We will find out the second highest salary from this table. Write the following query in the query analyser.
- select min(salary) from EmpSalary where Salary in(select top 2 Salary from EmpSalary order by salary desc)

For finding out the 3rd highest salary just replace 2 by 3 in the sql command.
- select min(salary) from EmpSalary where Salary in(select top 3 Salary from EmpSalary order by salary desc)

Gaurav GuptaPosted Apr 6, 2015, 5:30 AM
This will not works with duplicate values. If u will try to find out the 6th highest salary, then probably it gives u wrong Output...