Reputation: 13610
I want to create chart that displays users growth over time, so can I in SQL count my users by Year, month and day and also sum up previous counts?
For instance:
4/1/2013 - 1
4/2/2013 - 2
4/4/2013 - 1
4/9/2013 - 4
Want the result:
4/1/2013 - 1
4/2/2013 - 3
4/4/2013 - 5
4/9/2013 - 9
Upvotes: 0
Views: 44
Reputation: 7189
select a.date1,sum(b.id) as Mark
from tab a cross join tab b
where b.id <= a.id
group by a.id,a.date1
Upvotes: 1