Linq to SQL: Get top 10 most ordered products

hoipagnopay

New Member
I'm wanting to grab the 10 most ordered products. My tables look similar to this:Product
\[code\]ProductID | ProductName\[/code\]OrderedProduct
\[code\]ProductID | OrderID\[/code\]Order
\[code\]OrderID | DateOrdered\[/code\]At the moment I've got the following:\[code\]return (from product in db.Products from orderedProduct in db.OrderedProducts where orderedProduct.ProductID == product.ProductID select product).OrderByDescending(???).Distinct().Take(10);\[/code\]I've noted in the above query where I'm uncertain of what to put. How do I orderby the number of products that appear in the ordered products table?
 
Top