SELECT SQL_CACHE COUNT(c.country_id) AS showeventcount, c.country_id, FROM event e RIGHT JOIN country c ON c.country_id = e.country_id WHERE e.approved = 1 AND e.deleted = 0 AND (e.startdate >= CURDATE() OR (e.startdate <= CURDATE() AND e.enddate >= CURDATE())) GROUP BY country ORDER BY countryExpression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tomomi_confex.c.country_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by