Error Code: 1140. In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column ‘sys.yearsales.City’; this is incompatible with sql_mode=only_full_group_by
You can use the aggregate AVG
only by using the GROUP BY
:
SELECT country.continent, ROUND(AVG(city.population), 0) AS c
FROM city,country
WHERE city.countrycode = country.code
GROUP BY country.continent;