COUNT province by regione

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

COUNT province by regione

Post by sal21 »

paraphs i'm stupid...

based the 20 REGIONI how to count PROVINCE for each REGIONI?

for example for REGIONE=CAMPANIA have five distinct PROVINCE

to the and of query:

CAMPANIA 5
LAZIO 5
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78481
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: COUNT province by regione

Post by HansV »

Like this:

SELECT REGIONE, COUNT(PROVINCIA) AS CONTADIPROVINCIA FROM (SELECT DISTINCT REGIONE, PROVINCIA FROM [www-zip-codes-maps-com]) GROUP BY REGIONE
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: COUNT province by regione

Post by sal21 »

HansV wrote:
01 Jun 2022, 07:13
Like this:

SELECT REGIONE, COUNT(PROVINCIA) AS CONTADIPROVINCIA FROM (SELECT DISTINCT REGIONE, PROVINCIA FROM [www-zip-codes-maps-com]) GROUP BY REGIONE
Perfect!