Answers for "database sum of particular column field each different value"

0

database sum of particular column field each different value

You need to GROUP BY your customer id:

SELECT CustomerID, SUM(PurchasePrice) AS PurchaseTotal
FROM sales
GROUP BY CustomerID;

Customer ID  | Purchase price
10           | 1000
10           | 1010
20           | 2111
42           | 9954
10           | 9871
42           | 6121

######### Expecting a result like #######

Customer ID	| Purchase Total
10          | 11881
20          | 2111
42          | 16075
Posted by: Guest on April-21-2021

Code answers related to "database sum of particular column field each different value"

Browse Popular Code Answers by Language