Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Fehlercode 1111. Ungültige Verwendung der Gruppenfunktion

Sie müssen diese Bedingung also in das HABEN verschieben Klausel

SELECT c.name AS country_name, c.population AS country_population, SUM(ci.population) AS city_population, ROUND(100*(SUM(ci.population)/c.population)) AS city_population_percent
            FROM country AS c
            JOIN city AS ci
            ON c.code = ci.countrycode
WHERE c.continent = 'Europe'
GROUP BY c.name
HAVING ROUND(100*(SUM(ci.population)/c.population)) > 30