我进行了查询,但无法获取每一行的最大值。
SELECT P.ProductID, P.ProductName, Sum(OD.Quantity) AS SumOfQuantity, S.SupplierID
FROM Products AS P, Suppliers AS S, OrderDetails AS OD, Orders O
WHERE S.SupplierID=P.SupplierID AND P.ProductID=OD.ProductID
And O.OrderDate >=#01/01/2017# And O.OrderDate<#01/01/2018#
And O.OrderID=OD.OrderID
GROUP BY P.ProductID, P.ProductName, S.SupplierID
ORDER BY Sum(OD.Quantity) DESC
我尝试做极限1并拥有最大,但它不起作用。我也做不到Max(SUM)有什么办法吗?
答案 0 :(得分:1)
这是您想要的吗?
dp