Error: Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'admin_service.bots.country' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by Query: SELECT COUNT(*) AS cnt, country_code AS cc, country FROM bots WHERE (bvalid = 1 AND version > 90) AND ( country_code IN ('us', 'de', 'gb', 'fr', 'ca', 'se', 'es', 'au', 'it', 'ru', 'nl') ) GROUP BY country_code ORDER BY cnt DESC