I have a bunch of data stored in a table, each row ends with a ts
column, type TIMESTAMP
.
I want to get incremental counts up until a point, so for instance I have the following query:
SELECT YEARWEEK(ts), DATE(ts), COUNT(*) FROM
orderWHERE DATE(ts) >= '01/12/13' GROUP BY YEARWEEK(ts)
Which produces something like:
201346 20/11/2013 59
201347 24/11/2013 44
201348 01/12/2013 21
However I need a column that adds up the COUNTS up until that point, so I'd need something like:
201346 20/11/2013 59 59
201347 24/11/2013 44 103
201348 01/12/2013 21 124
How can I achieve this with mysql?? It's for a line graph, so I need to show that the numbers go up each week and I can't do that with the current SQL statement.