bug on Subselect with GROUP BY clause
jose' soares <sferac@bo.nettuno.it>
From: Sferacarta Software <sferac@bo.nettuno.it>
To: pgsql-hackers@postgresql.org
Date: 1999-01-04T13:53:35Z
Lists: pgsql-hackers
Hi all,
Seems there's a bug using GROUP BY not on select list on subselects:
SELECT city, AVG(account)
FROM customer
GROUP BY city
HAVING AVG(account) >= ALL
(SELECT city,AVG(account)
FROM customer group by city
);
ERROR: parser: Subselect has too many or too few fields.
Instead the following does work:
SELECT city, AVG(account)
FROM customer
GROUP BY city;
city |avg
--------+---
Chicago | 10
Dallas | 60
New York| 50
(3 rows)
SELECT AVG(account)
FROM customer
GROUP BY city;
avg
---
10
60
50
(3 rows)
-Jose'-