Saturday, July 18, 2009

how to select top 2 max record in sql server

write the query for find the top 2 highest salary in sql server

select esalary from emp_sal e where 2>=(select count(distinct esalary)
from emp_sal where e.esalary<=esalary)

No comments:

Post a Comment