Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 's179_main.bvspr_news.publishing_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by. SELECT YEAR(publishing_date) AS year, DATE_FORMAT(publishing_date, "%m") AS month, COUNT(1) AS amount FROM bvspr_news WHERE is_published = 1 GROUP BY DATE_FORMAT(publishing_date, "%Y-%m") ORDER BY publishing_date DESC