Jim
Jim

Reputation: 117

Need to generate report using LINQ

I have a table and I want to generate report from it. enter image description here

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

Answers (1)

Mahesh
Mahesh

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

Related Questions