sql - Include a record only if it has more than 20 related records -
this statement i'm using:
select country.code "country code", country.name country, count(countrycode) "number of cities" city, country city.countrycode = country.code group country.code, country.name;
i need select countries have more 20 cities. create view query afterwards.
use having
clause aggregate functions:
... group country.code, country.name having count(countrycode) > 20;
Comments
Post a Comment