Select multiple fields group by and sum
Updated : If you’re trying to avoid grouping for all the fields, you can group just by Id: data.GroupBy(d => d.Id) .Select( g => new { Key = g.Key, Value = g.Sum(s => s.Value), Name = g.First().Name, Category = g.First().Category }); But this code assumes that for each Id, the same Name and Category apply. … Read more