tags:

views:

24

answers:

1

Hi all

I have a bunch of incidences in a table that are linked to a supplier

I need to some 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)

A: 

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) });
Vasu Balakrishnan