From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: Count and list only where count is bigger than 1
Date: Tue, 19 Sep 2006 17:15:09 +0200
Message-ID: <20060919151509.GB14455@a-kretschmer.de> (raw)
In-Reply-To: <55c095e90609190804w1eaac2aanc660020995d3710a@mail.gmail.com>
References: <55c095e90609190804w1eaac2aanc660020995d3710a@mail.gmail.com>
am Tue, dem 19.09.2006, um 12:04:55 -0300 mailte Ezequias Rodrigues da Rocha folgendes:
> 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 ?
>
> What to do ?
HAVING.
17:14 < akretschmer> ??having
17:14 < pg_docbot_ads> For information about 'having' see:
17:14 < pg_docbot_ads> http://www.postgresql.org/docs/current/interactive/queries-table-expressions.html#QUERIES-GROUP
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: andreas.kretschmer@schollglas.com
Subject: Re: Count and list only where count is bigger than 1
In-Reply-To: <20060919151509.GB14455@a-kretschmer.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox