Entity Framework : Group by and Join

c# entity-framework-6 group-by join

Accepted Answer

Do this:

var statistics = database.Task
    .GroupBy(t => new { Id = t.StatusId, Name = t.Status.Name })
    .Select(g => new { StatusId = g.Key.Id, StatusName = g.Key.Name, Count = g.Count() })
    .ToList();
1
2/2/2016 11:05:49 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow