Re: Selecting count of details along with details columns

From: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>
To: Axel Rau <Axel(dot)Rau(at)chaos1(dot)de>
Cc: Richard Huxton <dev(at)archonet(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Selecting count of details along with details columns
Date: 2005-09-29 19:29:57
Message-ID: 1128022197.29347.56.camel@state.g2switchworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ricky Sutanto 2005-09-30 02:16:17 unsubscribe
Previous Message Axel Rau 2005-09-29 19:08:15 Re: Selecting count of details along with details columns