Linq group by multiple fields with join

 var affiliati = from c in db.Cars
                 join s in db.CarsSold on c.Id equals s.CarId
                 where s.SellingPrice > 10000
                 group new { c.Id, c.Model }
                 by new { c.Id, c.Model } into g
                 orderby g.Key.Model
                 select new
                     Id = g.Key.Id,
                     Model = g.Key.Model

Leave a Comment

Your email address will not be published. Required fields are marked *