0

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.

1 Answer 1

2

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.