简体   繁体   中英

Need to generate report using LINQ

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. ie

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 ?

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()});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM