Radical_Activity Radical_Activity - 7 months ago 12
SQL Question

How to get a daily SUM of numbers with MySQL?

I have a table, which looks like the following:

Table

users
:

id points date
1 100 2014-07-01
2 500 2014-07-02
3 200 2014-07-01
4 100 2014-07-03
5 100 2014-07-01
6 400 2014-07-02
7 800 2014-07-02
8 200 2014-07-02


Now, how is it possible to select each
unique
date and count the sum of the points on those days?

So I's need a result something like this:

points date
400 2014-07-01
1900 2014-07-02
100 2014-07-03

Answer
SELECT   SUM(`points`) AS points, `date`
FROM     users
GROUP BY `date`