【发布时间】:2013-09-23 10:43:28
【问题描述】:
我使用以下语句读出用户注册
SELECT DAY(p.creationInstant) as day, MONTH(p.creationInstant) as month,
YEAR(p.creationInstant) as year, count(p.id) as users
FROM person p WHERE p.enrollmentStatus ="Enrolled"
GROUP BY year, month, day
ORDER BY year, month, day
这会给我以下输出:
day month year users
1 1 2013 3
2 1 2013 5
3 1 2013 7
...
现在我想有一个总结用户的第四列:
day month year users **totalUsers**
1 1 2013 3 3
2 1 2013 5 8
3 1 2013 7 15
...
但不知何故,我无法弄清楚如何使用 SQL (dbms: mySQL) 来做到这一点。
【问题讨论】:
-
查看运行总计,例如stackoverflow.com/questions/664700/…
-
“running totals”本来就是搜索词!天啊...有时我的母语是英语...谢谢@StuartLC