Reputation:
I have a bunch of incidences in a table that are linked to a supplier
I need to sum the serverity score for those incidences by supplier
So basicly have supplier1: 500 supplier2: 600
How do I do this?
DataAccess.IncidentRepository().GetItems().Where(i => i.IncidentDate.Year == 2006)
Upvotes: 0
Views: 152
Reputation: 1771
Hope this helps
DataAccess.IncidentRepository().GetItems()
.Where(i => i.IncidentDate.Year == 2006)
.GroupBy(i => i.Supplier)
.Select(pGroup =>
new { Supplier = pGroup.Key,
Score = pGroup.Sum(pArg => pArg.SeverityScore) });
Upvotes: 1