我想在用户指定的日期内退回前 10 名最畅销的产品(数量最多)。
我来自数据库的表:
订单
OrderId | OrderDate
订购_产品:
ProductID | OrderID | Quantity
产品
ProductID | ProductName | ProductDescription
代码:
return (from product in this.Entities.Products
from orderProduct in this.Entities.Order_Product
from order in this.Entities.Orders
where order.OrderId = orderProduct.ProductID && orderProduct.ProductID == product.ProductID
where (order.OrderDate >= date1 && <= date2)
select product).OrderByAscending(COUNT(Quantity)).Distinct().Take(10);
代码到现在。