Re: [BUGS] Bug with a join and group by query.
Bruce Momjian <maillist@candle.pha.pa.us>
From: Bruce Momjian <maillist@candle.pha.pa.us>
To: miker@scifair.acadiau.ca (Michael Richards)
Cc: bugs@postgreSQL.org
Date: 1999-02-22T02:42:06Z
Lists: pgsql-bugs
> Hi. > I think I found a bug. My query works in mysql. > I have 2 tables. It's for a classifieds database. 1 is the categories, and > the second is the postings. Postings are categorised and related to a > category. I'll dump the contents of the tables and append it to the > message if anyone wants test data. > > postgres 6.4 does: > select cl_categories.catid,cl_categories.description,count(*) from > cl_categories,cl_postings where catid=categoryid group by catid; > ERROR: parser: illegal use of aggregates or non-group column in target > list You must group by all non-aggregate fields. That includes description. -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026