var groupByList = from items in list group items by new { items.TargetCompanyId,//分组的字段 items.TargetCompanyName, items.ExamItemType, items.ProcessId, items.ProcessName, items.TargetOptionId, items.TargetOptionName, items.EngUnitId, items.Ranking } into c select new {//显示的字段 c.Key.TargetCompanyId, c.Key.TargetCompanyName, c.Key.ExamItemType, c.Key.ProcessId, c.Key.ProcessName, c.Key.TargetOptionId, c.Key.TargetOptionName, c.Key.EngUnitId, c.Key.Ranking, ExamValue = c.Average(g => g.ExamValue)//根据分组的字段求和或者求平均值 };
浙公网安备 33010602011771号