1
I have a table where the registration date is stored in the DATE() format. The registration comes from 2013 and takes every day and month 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 lists 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;
Only he returns this way:
And when I try to group the year:
I only need the query, because I will use PHP for the listing.
Hello Gabriel. Okay, but how would I apply for my solution? Because I need to create this filter to do the way I mentioned in the post.
– user24136
SELECT MONTH(Datacadastre) AS Mescadastro, YEAR(Datacadastro) AS Anocadastro FROM
tabela
Where Datacadastro between '01.01.2013' and '31.01.2013' GROUP BY Mescadastro;– GabrielLocalhost