count(*) and group by's...

From: Howie <caffeine(at)toodarkpark(dot)org>
To: pgsql-sql(at)postgreSQL(dot)org
Cc: caffeine(at)toodarkpark(dot)org
Subject: count(*) and group by's...
Date: 1998-10-20 16:59:49
Message-ID: Pine.LNX.3.96.981020125545.10567E-100000@brap-eth0.toodarkpark.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I give up. I'm trying to get a count of one table joining with another,
but Postgres ( 6.3.2 ) doesnt like me.

SELECT types.type,hosts.hostname,types.batch,count(codes.code) FROM
hosts,types,codes WHERE hosts.client=3 AND hosts.client=types.client AND
types.type=codes.type GROUP BY types.type ORDER BY types.batch;

returns:

ERROR: parser: illegal use of aggregates or non-group column in target
list

in fact, trying to do any join across types and codes results in an
illegal use/non-group column. types.type is primary,
codes.type+codes.code is primary.

---
Howie <caffeine(at)toodarkpark(dot)org> URL: http://www.toodarkpark.org
"Oh my god, they killed init! YOU BASTARDS!"

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David Hartwig 1998-10-20 17:39:04 Re: [SQL] count(*) and group by's...
Previous Message Jackson, DeJuan 1998-10-20 14:46:03 RE: [SQL] timespan question: using value from row in select