GROUP BY month on DATETIME field
Could you try this?
select count(*), DATE_FORMAT(timestamp, "%Y-%m-01")from titlegroup by DATE_FORMAT(timestamp, "%Y-%m-01")
Please, note that MONTH()
can't differentiate '2013-01-01' and '2014-01-01' as follows.
mysql> SELECT MONTH('2013-01-01'), MONTH('2014-01-01');+---------------------+---------------------+| MONTH('2013-01-01') | MONTH('2014-01-01') |+---------------------+---------------------+| 1 | 1 |+---------------------+---------------------+