I'm trying to query the Northwind database relationship between Categories and Products, where each category has multiple products...
Im looking for a query that will return the 1 category with the highest number of products in it.
This is as far as I've gotten
var results = from c in entities.CategorySet
orderby c.Products.Count descending
select new {
CategoryName = c.CategoryName,
ProductCount = c.Products.Count
};
var result = results.Take(1).First();
is there a more effective way?