sql >> Database teknologi >  >> RDS >> Mysql

Fejlkode 1111. Ugyldig brug af gruppefunktion

Så du skal flytte denne betingelse til HAVING klausul

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

  1. Sådan bruges Where-klausulen i Select Statement i SQL Server - SQL Server / TSQL Tutorial Del 109

  2. Fejlfinding af Microsoft SQL Server-fejl 18456

  3. Et til mange forhold i MyBatis

  4. Sådan fungerer CHARINDEX()-funktionen i SQL Server (T-SQL)