Tuesday, April 20, 2010

TOP Nth SALARY IN SQLSERVER2005

Top Second Salary :-

select top 1 salary from employee where salary in (select top 2 salary from employee order by salary desc ) order by salary


Top Third Salary :-

select top 1 salary from employee where salary in (select top 3 salary from employee order by salary desc ) order by salary

Just change the value in Inner Query(2,3,4.........)

1 comment: