I've been searching for a way to make this but I haven't had success. The following is my problem, I have a table that look like this:
ID|CATEGORY|START_DATE |END_DATE 1 T1 2019-08-29 12:00:00 2019-08-29 12:10:00 2 T1 2019-08-30 13:00:00 2019-08-30 13:20:00 3 T2 2019-08-30 14:00:00 2019-08-30 14:10:00 What I want to do is to GROUP BY Category AND SUM the difference between both dates and get a result like this: T1 --> 30 minutes, t2 --> 10 minutes
This is what I've tried:
foreach (IGrouping<string, TABLE1> group in result) { series.Add(new PieSerie("SerieName", group.AsEnumerable().Sum(x => (x.START_DATE- x.END_DATE).Value.Seconds ))); } But it doesn't work. Every single result I get is '0' instead of the total of minutes.