pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
having trouble w/ having clause...
4+ messages / 3 participants
[nested] [flat]

* having trouble w/ having clause...
@ 2002-05-08 20:58  Mike Diehl <jdiehl@sandia.gov>
  0 siblings, 1 reply; 4+ messages in thread

From: Mike Diehl @ 2002-05-08 20:58 UTC (permalink / raw)
  To: pgsql-sql

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;

I'm running 7.2.

Thanx in advance,

-- 
Mike Diehl
Network Tools Devl.
Sandia Labs
(505) 284-3137



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: having trouble w/ having clause...
@ 2002-05-08 23:13  Ian Barwick <barwick@gmx.net>
  parent: Mike Diehl <jdiehl@sandia.gov>
  0 siblings, 1 reply; 4+ messages in thread

From: Ian Barwick @ 2002-05-08 23:13 UTC (permalink / raw)
  To: jdiehl@sandia.gov; 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





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: having trouble w/ having clause...
@ 2002-05-09 19:21  Mike Diehl <jdiehl@sandia.gov>
  parent: Ian Barwick <barwick@gmx.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Mike Diehl @ 2002-05-09 19:21 UTC (permalink / raw)
  To: Ian Barwick <barwick@gmx.net>; pgsql-sql

Yep, this fixed it.  Thanx,

On Wednesday 08 May 2002 05:13 pm, Ian Barwick wrote:
     > 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

-- 
Mike Diehl
Network Tools Devl.
Sandia Labs
(505) 284-3137



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: having trouble w/ having clause...
@ 2002-05-13 06:35  Wolfgang.Fuertbauer@ebewe.com
  0 siblings, 0 replies; 4+ messages in thread

From: Wolfgang.Fuertbauer@ebewe.com @ 2002-05-13 06:35 UTC (permalink / raw)
  To: jdiehl@sandia.gov; +Cc: pgsql-sql; pgsql-sql-owner@postgresql.org


On 08.05.2002 22:58:59 pgsql-sql-owner 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;
W

>
>I'm running 7.2.
>
>Thanx in advance,




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-05-13 06:35 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-05-08 20:58 having trouble w/ having clause... Mike Diehl <jdiehl@sandia.gov>
2002-05-08 23:13 ` Ian Barwick <barwick@gmx.net>
2002-05-09 19:21   ` Mike Diehl <jdiehl@sandia.gov>
2002-05-13 06:35 Re: having trouble w/ having clause... Wolfgang.Fuertbauer@ebewe.com

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