我已经为发布者准备了一个包含不同记录的表,每条记录在时间戳类型的列中都有一个日期。
id | id_publisher | date
1 1 11/2012 03:09:40 p.m.
2 1 12/2012 03:09:40 p.m.
3 2 01/2013 03:09:40 p.m.
4 3 01/2013 03:09:40 p.m.
5 4 11/2012 03:09:40 p.m.
6 4 02/2013 03:09:40 p.m.
7 4 02/2012 03:09:40 p.m.
我需要计算每个出版商每个月发布的记录数。例如
Month | id_publisher | num
11/2012 | 1 | 1
11/2012 | 2 | 0
11/2012 | 3 | 0
11/2012 | 4 | 1
.....
02/2013 | 4 | 2
我试过了
select count(id) from raw_occurrence_record group by month(date), id_publisher;
但是,它没有用。