Friday, December 16, 2011

how to find 2nd highest salary



select Max(Salary) from tblSalaryDetails  where salary   Not IN(select Max(Salary) from tblSalaryDetails )


for 6 ,7 and other

select max(salary) from EmployeeDetails

where Salary NOT IN
(
SELECT TOP 5 (SALARY) from EmployeeDetails ORDER BY Salary Desc)

No comments:

Post a Comment