Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Last active December 18, 2015 13:09
Show Gist options
  • Save wullemsb/5787754 to your computer and use it in GitHub Desktop.
Save wullemsb/5787754 to your computer and use it in GitHub Desktop.
Linq sample of grouping by multiple keys
var query = from order in context.Orders
group order by new { order.Customer , order.OrderDate } into ordersForCustomer
select
new
{
Key1 = ordersForCustomer.Key.Customer,
Key2=ordersForCustomer.Key.OrderDate,
Count=ordersForCustomer.Count()
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment