Re: Count and list only where count is bigger than 1 - Mailing list pgsql-sql

From bnichols@ca.afilias.info
Subject Re: Count and list only where count is bigger than 1
Date
Msg-id 1148.207.219.45.39.1158678586.squirrel@look.libertyrms.com
Whole thread Raw
In response to Count and list only where count is bigger than 1  ("Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com>)
List pgsql-sql
> Hi list,
>
> It is possible to make a count select and only display where count column
> is
> bigger than 1 ?
>
> My SQL is like this
>
> SELECT distinct cli.bairro, COUNT( * ) as qtd
> FROM base.cliente cli
> GROUP BY cli.cidade, cli.bairro
> ORDER BY 2
>
> I noticed that I cannot use "where qtd > 1" ok ?

SELECT distinct cli.bairro, COUNT( * ) as qtd
FROM base.cliente cli
GROUP BY cli.cidade, cli.bairro
HAVING count(*) > 1;





pgsql-sql by date:

Previous
From: Mezei Zoltán
Date:
Subject: Re: Count and list only where count is bigger than 1
Next
From: "A. Kretschmer"
Date:
Subject: Re: Count and list only where count is bigger than 1