var py = from p in s.Query<Product>() from o in p.Orders group o by new { p.ProductId } into grp select new { grp.Key.ProductId, Count = grp.Count() };
...you can do it with lambda approach:
var py = from p in s.Query<Product>() .SelectMany(_ => _.Orders) .GroupBy(_ => new { _.Product.ProductId }) select new { p.Key.ProductId, Count = p.Count() };
No comments:
Post a Comment