Reputation: 117
I have a table and I want to generate report from it.
I need to generate reporter using LINQ given the route and shift it returns the list of dates with the number of subscriptions for each day. i.e
given route 2022, shift 2120 it give me a list with the following
date count
2015-05-01 5
2015-05-02 10
2015-05-03 8
....
any clue ?
Upvotes: 0
Views: 380
Reputation: 8892
Your input does not match the output. But I am assuming you are showing partial input from your data. Then You can try,
var result = mydata.Where(x=>x.route.Equals("2022") && x.shift.Equals("2120"))
.GroupBy(x=> x.Date).Select(grp => new {Date = grp.Key, Count = grp.Count()});
Upvotes: 3