Re: Count and list only where count is bigger than 1

From: Mezei Zoltán <mezei(dot)zoltan(at)telefor(dot)hu>
To: Ezequias Rodrigues da Rocha <ezequias(dot)rocha(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Count and list only where count is bigger than 1
Date: 2006-09-19 15:09:35
Message-ID: 4510082F.203@telefor.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

<!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(at)mail(dot)gmail(dot)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 &gt; 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(*) &gt; 1<br>
<br>
Zizi<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 813 bytes

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message bnichols 2006-09-19 15:09:46 Re: Count and list only where count is bigger than 1
Previous Message Ezequias Rodrigues da Rocha 2006-09-19 15:04:55 Count and list only where count is bigger than 1