none
How can I get the maximum rows from the tabel RRS feed

  • Question

  • Hi,

    Am working on report by using Linq. On my report I want to display the last chekin of the user name, label and amount from several of the checkin made by user. I managed to display the name and label only one time but the amount is the sum of all the checkin. So how can I get the correct amount which the user use on the last checkin? Any idea? Please?

    H.
    Tuesday, December 22, 2009 8:21 AM

Answers

  • Hi,

    Inferring field names from your question, you can achieve the rows with latest checkins using the following query.

    from p in UserCheckins
    group p by p.UserName into grp
    let max = grp.Max( u=>u.CheckinDate )
    select grp.First( g=>g.CheckinDate==max )


    Hope that helps.

    Regards,
    Syed Mehroz Alam
    My Blog | My Articles
    Tuesday, December 22, 2009 11:38 AM