SELECT B.CustomerID, SUM(C.UnitPrice * C.Quantity) AS "Total Value"
FROM Orders B, Order_Det C
WHERE B.OrderID = C.OrderID AND “Total Value” = (SELECT MAX(“Total Value”) FROM Order_Det)
GROUP BY B.CustomerID
ORDER BY "Total Value";
上面的以下代码是我尝试过的。一个客户可以下多个订单。因此,我想通过购买数量和单价的倍数来显示最有价值的客户。我面临的问题是我无法归档谁是最有价值的客户。请指导我。时间