Posts Tagged ‘Group By’

Group By with LINQ

Today i wanted to do a group by query with LINQ wich is something i never done before. I turned out to be kind of easy.
If you just want to group by a single field.
(from s in db.CrewStatsSet
where s.LogDate >= date1 && s.LogDate <= date2 && s.Action == action
group s by s.User.nick into g
orderby g.Count() [...]