Posted By

Krummelz on 10/06/11


date to max field entities BY group Linq

Versions (?)

LinQ to Entities, Max Date Field, Grouped By whatever

 / Published in: C#


  1. from p in PersonOrders
  2. // put your where clause here
  3. group p by p.PersonID into grp //could be grouped by anything, Grouping on Guid ID's is not a good idea
  4. let MaxOrderDatePerPerson = grp.Max ( g=>g.OrderDate )
  6. from p in grp
  7. where p.OrderDate == MaxOrderDatePerPerson
  8. select p

Report this snippet  

You need to login to post a comment.