I have a table where the date of registration in DATE () format is stored. The registration comes from 2013 and picks up every day and months until December 2017:
2013-01-01
2013-01-02
2013-01-03
......
2017-12-01
2017-12-02
2017-12-03
I would like to filter as follows:
January 2013
..... Here you can see all records from January 1st to January 31st, 2013 ....
and so on until December 2017.
In mysql I tried this way:
SELECT MONTH(DataCadastro) AS MesCadastro, YEAR(DataCadastro) AS AnoCadastro FROM 'tabela' GROUP BY MesCadastro;
But it returns like this:
AndwhenItrytogrouptheyear:
I need only the query, because I'm going to use PHP for the listing.