Hi
I am working on a table where user’s score is stored along with the date and their userid.
Now I want to create a page where they would be able to see their weekly score as one number .
For example a user has 10, 20 , 5 , 35 score on mon, wed, fri, sat .
so on their scorecard they would see their weekly score as week 01 = 70, week 02 = 65 etc etc
current query I have in my mind
select scores.userid, sum(score) as sum
from scores
where scores.userid = '2222'
and scores.created between '2015-07-01 00:00:00' and DATE_ADD('2015-07-01 00:00:00', INTERVAL 7 DAY )
In this scenario I have to run query multiple times to get scores for each week.
Is there a better way to get result from query like
2222 | 20
2222 | 25
2222 | 33
and so on for each week?
Thanks