From: Mezei Zoltán <mezei.zoltan@telefor.hu>
To: Ezequias Rodrigues da Rocha <ezequias.rocha@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Count and list only where count is bigger than 1
Date: Tue, 19 Sep 2006 17:09:35 +0200
Message-ID: <4510082F.203@telefor.hu> (raw)
In-Reply-To: <55c095e90609190804w1eaac2aanc660020995d3710a@mail.gmail.com>
References: <55c095e90609190804w1eaac2aanc660020995d3710a@mail.gmail.com>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000099">
Ezequias Rodrigues da Rocha wrote:
<blockquote
cite="mid55c095e90609190804w1eaac2aanc660020995d3710a@mail.gmail.com"
type="cite">SELECT distinct cli.bairro, COUNT( * ) as qtd<br>
FROM base.cliente cli<br>
GROUP BY cli.cidade, cli.bairro<br>
ORDER BY 2<br>
<br>
<span style="font-weight: bold;">I noticed that I cannot use "where
qtd > 1" ok ?</span><br>
<br>
What to do ?<br>
</blockquote>
Google/read tutorial for HAVING. E.g.<br>
<br>
SELECT distinct cli.bairro, COUNT( * ) as qtd<br>
FROM base.cliente cli<br>
GROUP BY cli.cidade, cli.bairro<br>
HAVING COUNT(*) > 1<br>
<br>
Zizi<br>
</body>
</html>
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: mezei.zoltan@telefor.hu, ezequias.rocha@gmail.com
Subject: Re: Count and list only where count is bigger than 1
In-Reply-To: <4510082F.203@telefor.hu>
* 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