How to get nth Highest salary of Employee in Department wise

select * from
(
select EmployeeName,  DeptID,  Sal,  Rank()
over (Partition BY EmployeeName  order by Sal DESC, DeptID DESC)
as Rank
from
Employee
) tmp
where Rank = @n

Comments

Popular posts from this blog

How to Convert Word Document to PDF using C#

Loop Through Dates in SQL