Query (SELECT COUNT(*) AS offender_count, countyid, location_new.name as county_name, location_new.namelsad as county_display FROM address INNER JOIN location_new ON location_new.location_id = address.countyid WHERE address.state = 'MT' and city!='' group by countyid order by offender_count desc limit 10 ) Failed. Error : Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sexoffender_latest.location_new.name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by