Monday, March 2, 2009

how to select the second largest salary from a table?

Select Top 1 from Employee where Salary Not IN ( select Top 1 from Employee order by Salary Desc)order by Salary Desc
OR
select max(sal) from employee where sal != (select max(sal) from employee)
OR
Select Max(salary)From EmployeeWhere salaryNOT IN (Select max(salary) From Employee)

No comments:

Post a Comment