Re: Aggregates not allowed in WHERE clause?

From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Aggregates not allowed in WHERE clause?
Date: 2004-12-16 06:22:45
Message-ID: m34qim4v9m.fsf@knuth.knuth.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

A long time ago, in a galaxy far, far away, fransgunawan(at)gmail(dot)com (Frans) wrote:
> This yields the message: 'Aggregates not allowed in WHERE clause'.
>
> Can somebody help me here....

What it says is right; SQL does not permit using aggregates in the
WHERE clause.

You need to look at the HAVING clause which is, more or less, the
equivalent to WHERE specifically for use with aggregates...
--
(format nil "~S(at)~S" "cbbrowne" "gmail.com")
http://www.ntlug.org/~cbbrowne/nonrdbms.html
"If use of the GPL filters out people who are only interested in
inventing the worst possible motives for my actions then, yes, I'm
happy to learn that it serves a useful purpose I'd never thought of."
-- Dave Pearson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mickael Remond 2004-12-16 07:16:54 Re: Insert do not work in my case
Previous Message Michael Fuhr 2004-12-16 05:37:19 Re: Aggregates not allowed in WHERE clause?