From: | Ian Barwick <barwick(at)gmx(dot)net> |
---|---|
To: | jdiehl(at)sandia(dot)gov, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: having trouble w/ having clause... |
Date: | 2002-05-08 23:13:22 |
Message-ID: | 200205090113.22872.barwick@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
On Wednesday 08 May 2002 22:58, Mike Diehl wrote:
> Hi all,
>
> This is a simple question, but for the life of me, I can't see what is
> wrong with this query:
>
> select host,slot,port,count(mac) as d from cam group by host,slot,port
> having d>1;
Try:
select host,slot,port,count(mac) as d from cam group by host,slot,port
having count(mac) > 1
See:
http://www.postgresql.org/idocs/index.php?sql-select.html
"output_name
Specifies another name for an output column using the AS clause. This name is
primarily used to label the column for display. It can also be used to refer
to the column's value in ORDER BY and GROUP BY clauses. But the output_name
cannot be used in the WHERE or HAVING clauses; write out the expression
instead."
HTH
Ian Barwick
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Lu | 2002-05-08 23:53:24 | What are the procedures for upgrading from 7.1.2 to 7.2 |
Previous Message | Nigel J. Andrews | 2002-05-08 23:11:46 | Re: OLAP idea |
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Kings-Lynne | 2002-05-09 01:50:36 | Re: Migrating from 7.1 to 7.2 |
Previous Message | Masaru Sugawara | 2002-05-08 22:33:27 | Re: blanking out repeated columns in rows |