Tuesday 1 April 2014

linq get second highest number or salary

Use this query:

var employees = Employees
    .GroupBy(e => e.Salary)
    .OrderByDescending(f => f.Key)
    .Skip(1).Take(1)
    .First();

No comments:

Post a Comment