SQLTeam.com | Weblogs | Forums

Return Total Cost of item for each customer

Hello everyone,
I'm very new to SQL. It's indeed very interesting and challenging too. I have started to imagine scenarios to practice. I have 2 questions for now.
This is my table:

(a) What's the query for the total amount of money spent by each customer?
I tried this but it's wrong!
Select DISTINCT item AS 'Customer Identification', SUM(amount) AS 'Total Cost'
From Orders

(b) What's the query for the number of items each customer bought?
For ex: Customer 2 has 3 items.


1 Like