The problem I am trying to solve is as follows
For each continent show the continent and number of countries with populations of at least 10 million
The world table looks like this:
World (name, continent, area, population, gdp)
My query (which is not returning the correct result):
SELECT continent, COUNT(name)
FROM world
GROUP BY continent
HAVING sum(population) >= 10000000
Query returning the correct result:
SELECT continent, COUNT(name)
FROM world
WHERE population >= 10000000
GROUP BY continent
Can someone tell me why my query is wrong?