I am trying to select dates from my DB and then group it as months and years for example:
May 2019
June 2018
etc.
DB -the date is type date
I have this code:
SELECT datum, count(*) FROM zapasy GROUP BY datum
Which makes it on each day, but I don't want that so I searched how to make it group as months and years, not just days
SELECT datum, count(*) FROM zapasy GROUP BY MONTH(datum), YEAR(datum)
and I came up with this, however, I am getting this stupid error
#1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'zapasy_db_test.zapasy.datum' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
And I have no idea what is wrong with the code
Please, give me some advice. Thank you