Missing the GROUP BY
clause:
WITH
anaq1 as
( SELECT
POPULATION,
YEAR,
COUNTRY_OR_AREA
FROM POPULATIONS2
WHERE
country_or_area = 'France' OR
country_or_area = 'Brazil'
)
select
COUNTRY_OR_AREA ,
COUNT(*) AS OCCURANCES
from anaq1
GROUP BY COUNTRY_OR_AREA
ORDER BY COUNT(*) DESC
The whole thing could be simplified:
SELECT COUNTRY_OR_AREA, COUNT(*) AS OCCURANCES
FROM POPULATIONS2
WHERE country_or_area in ('France', 'Brazil')
GROUP BY COUNTRY_OR_AREA
ORDER BY COUNT(*) DESC
This is counting the number of times a country or area record shows up in the populations2 table.