Yes, you can order your groups by anyone as long as the expression creates a comparable object. For example, you can order a minimum or maximum quantity * but not just quantity, because a group can have many different quantities.
var data= from c in customers
join o in orders
on c.id=o.id
group new { c, o } by new { o.customerid, c.FirstName, c.LastName, c.City } into customergroups
orderby customergroup.Max(x=>x.o.quantity);
* You can also use First(x=>x.o.quantity)or Last(x=>x.o.quantity), but the order will be arbitrary.
source
share