Reputation: 102
I have a table constructed like this :
Date | Account | Total
1 | A | 1000
3 | A | 1000
4 | A | 200
5 | A | 3000
2 | B | 100
3 | B | 2000
4 | C | 500
I'd like to query this table to get a result like this :
Date | Total
1 | 1000
2 | 100
3 | 3000
4 | 700
5 | 3000
Basically, I don't care about the account but want to sum the total per date
I've been going around in circles trying to do this super simpple task! Can someone please help me? hanks! Thank you very much.
Upvotes: 0
Views: 32
Reputation: 2710
You are looking for GROUP BY
with an aggregate function: SUM
. Something like:
SELECT date, SUM(total)
FROM your_table_name
GROUP BY date
ORDER BY date;
Upvotes: 2