I have the query
SELECT
datecreate AS period,
count(cod) as qt
FROM `tablename`
WHERE `date` between CURDATE() - INTERVAL -1 year and CURDATE()
GROUP BY period
that returns
+----------+-----+
| period | qt |
+----------+-----+
|2015-10 | 5 |
+----------+-----+
|2015-11 | 7 |
+----------+-----+
|2016-06 | 9 | < --- the query ends here
+----------+-----+
|2016-05 | 0 | < --- what i need
+----------+-----+
...
...
...
to fill de date with the months that not are matched on the data range ( and count 0 ), because the date 2016-11 and above do not exists in table
i usually do it on the server but i think that can do it by SQL