更新时间:2023-02-05 08:10:20
您需要GROUP BY您的客户 ID:
GROUP BY
You need to GROUP BY your customer id:
SELECT CustomerID, SUM(PurchasePrice) AS PurchaseTotal FROM sales GROUP BY CustomerID;
MYSQL - 基于其他列中的公共值的列的总和
MySQL 分组依据和其他列的总和值