From: marten@feki.toppoint.de
To: pgsql-sql@postgreSQL.org
Subject: HAVING in EXISTS-clause ...
Date: Tue, 9 Nov 1999 12:26:21 +0100 (CET)
Message-ID: <199911091126.MAA27023@feki.phoenix-edv.netzservice.de> (raw)
Hello PostgreSQL user,
we're haveing some trouble when doing the following commands:
a) This statement works very well ...
SELECT AO,AT,AV FROM P3AT
GROUB BY AO
HAVING COUNT(*)>1
b) This statement works very well ...
SELECT AO,AT,AV FROM P3AT AS OAT
WHERE
EXISTS(
SELECT AO FROM P3AT
WHERE
AO = OAT.AO
GROUB BY AO)
c) This statement does NOT work. It gives an error message:
"rewrite: aggregate column of view must be ar rigth side in qual"
SELECT AO,AT,AV FROM P3AT AS OAT
WHERE
EXISTS(
SELECT AO FROM P3AT
WHERE
AO = OAT.AO
GROUP BY AO
HAVING COUNT(*) = 8)
The meaning of the statement is: return the result as triples, but
make sure, that you return only these results, where you have
eight result rows available for each AO.
Perhaps someone may help me !?
Marten
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: marten@feki.toppoint.de
Subject: Re: HAVING in EXISTS-clause ...
In-Reply-To: <199911091126.MAA27023@feki.phoenix-edv.netzservice.de>
References: <199911091126.MAA27023@feki.phoenix-edv.netzservice.de>
* 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