Formate o carimbo de data/hora e agrupe por ele.
Agrupar por mês:
SELECT DATE_FORMAT(t.timestamp, "%Y-%m") AS "_Month", COUNT(*)
FROM yourtable as t
GROUP BY _Month;
Agrupar por ano:
SELECT DATE_FORMAT(t.timestamp, "%Y") AS "_Year", COUNT(*)
FROM yourtable as t
GROUP BY _Year;
Se o campo timestamp for armazenado como um valor unixtime, apenas envolva
FROM_UNIXTIME()
ao redor do campo:SELECT DATE_FORMAT(FROM_UNIXTIME(t.timestamp), "%Y") AS "_Year", COUNT(*)
FROM yourtable as t
GROUP BY _Year;