Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Contar totais por ano e mês


Tente isto:
SELECT DATE_FORMAT(created, '%Y') as 'year',
DATE_FORMAT(created, '%m') as 'month',
COUNT(id) as 'total'
FROM table_name
GROUP BY DATE_FORMAT(created, '%Y%m')