Wednesday, August 15, 2012

How to Group by with multiple columns and SUM

 var thisInventories = inventories.GroupBy(x => new { x.Site, x.Make, x.Model })                 .Select(y => new NckInventory(null, y.Key.Make, y.Key.Model, y.Key.Site, y.Sum(p => p.RegisteredInterest)                     .ToString()))                     .ToList();

No comments: