我需要在每个员工人数(人数)上显示公司名称。
var result2 = (from c in NoOfEntities.listOfCompanies
join s in NoOfEntities.listOfStores on c.Id equals s.CompanyId
join p in NoOfEntities.listOfPersons on s.Id equals p.StoreId
group c by c.Name into newGroup
select newGroup );
我需要增加员工人数,但我不知道如何添加该计数器。
答案 0 :(得分:1)
var result2 = (from c in NoOfEntities.listOfCompanies
join s in NoOfEntities.listOfStores on c.Id equals s.CompanyId
join p in NoOfEntities.listOfPersons on s.Id equals p.StoreId
group p by c.Name into newGroup
select new
{
CompanyName = newGroup.Key,
NumberOfEmployees = newGroup.Count()
});