You must Sign In to post a response.
  • Category: LINQ

    Find 3rd highest salary in linq

    Find 3rd highest salary in linq using

    1. Linq Query

    2. Lambda expression
  • #744244
    Hi,

    please refer the below link:



    http://www.dotnetfunda.com/articles/show/2251/find-the-n-th-highest-salary-of-employee-using-linqlambda

  • #744245
    hiiii...
    Try this

    var salary = Employe
    .OrderByDescending(e => e.Salary)
    .Skip(2)
    .First();

    Thanks,
    Sini
    "Always Ready to accept challenges....."

  • #744289
    Hello

    you can use

    var Query = (from s in dtResult.AsEnumerable()
    orderby s.Field<decimal>("Salary") descending
    select s).Skip(2).Take(1);



    Thanks and Regards
    Umesh Bhosale

  • #744334
    Try making use of the SKIP function as below.



    var Customer = Customers
    .OrderByDescending(e => e.SalaryAmount)
    .Skip(2)
    .First();

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM


  • Sign In to post your comments