pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Axel Rau <Axel.Rau@chaos1.de>
Cc: Richard Huxton <dev@archonet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Selecting count of details along with details columns
Date: Thu, 29 Sep 2005 14:29:57 -0500
Message-ID: <1128022197.29347.56.camel@state.g2switchworks.com> (raw)
In-Reply-To: <409f1e679d5f8744e1609d5c447d5f15@Chaos1.DE>
References: <8365994213849c93946e61ded7d12318@Chaos1.DE>
	<433BA637.7040106@archonet.com>
	<a79cd5e3132c2d4c3430a34e64d93ebe@Chaos1.DE>
	<433BBC07.5040208@archonet.com>
	<409f1e679d5f8744e1609d5c447d5f15@Chaos1.DE>

On Thu, 2005-09-29 at 14:08, Axel Rau wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1

> Exactly, that query works as I expected. Thank you.
> Can you answer this question as well:
> > Looking for a workaround, I learned that aggregate functions are not 
> > allowed in WHERE clauses.
> > Question: Is this conform with the standard?

The problem is that where clauses "fire" before group by does, so the
aggregate doesn't exist yet when the where clause would be doing it's
selection.

Which is why the spec, and postgresql, have the "having" clause...

See this part of the docs:

http://www.postgresql.org/docs/8.0/interactive/sql-select.html



view thread (6+ messages)

Message-ID: <1128022197.29347.56.camel@state.g2switchworks.com>
Permalink:  ../1128022197.29347.56.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1128022197.29347.56.camel@state.g2switchworks.com

 · 

reply

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: smarlowe@g2switchworks.com, Axel.Rau@chaos1.de, dev@archonet.com
  Subject: Re: Selecting count of details along with details columns
  In-Reply-To: <1128022197.29347.56.camel@state.g2switchworks.com>

* 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