我有一张带有条目和时间/日期戳的表。例如:
1 2014-03-14 12:34:49
2 2014-03-14 12:34:49
3 2014-03-14 12:34:49
4 2014-03-25 09:59:15
5 2014-03-25 09:59:15
etc.....
我想计算每月的条目数
我已经尝试过了
SELECT COUNT(1) AS entries, DATE(timestmp) as date
FROM remlog
GROUP BY DATE(timestmp)
答案 0 :(得分:0)
使用month()
SELECT COUNT(*) AS entries, month(timestmp) as date
FROM remlog
GROUP BY month(timestmp)