pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcount(*) and group by's...
2+ messages / 2 participants
[nested] [flat]
* count(*) and group by's...
@ 1998-10-20 16:59 Howie <caffeine@toodarkpark.org>
1998-10-20 17:39 ` Re: [SQL] count(*) and group by's... David Hartwig <daveh@insightdist.com>
0 siblings, 1 reply; 2+ messages in thread
From: Howie @ 1998-10-20 16:59 UTC (permalink / raw)
To: pgsql-sql; +Cc: caffeine@toodarkpark.org
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@toodarkpark.org> URL: http://www.toodarkpark.org
"Oh my god, they killed init! YOU BASTARDS!"
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] count(*) and group by's...
1998-10-20 16:59 count(*) and group by's... Howie <caffeine@toodarkpark.org>
@ 1998-10-20 17:39 ` David Hartwig <daveh@insightdist.com>
0 siblings, 0 replies; 2+ messages in thread
From: David Hartwig @ 1998-10-20 17:39 UTC (permalink / raw)
To: Howie <caffeine@toodarkpark.org>; +Cc: pgsql-sql
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, hosts.hostname, types.batch
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ORDER BY types.batch;
-- All columns in the target (projection) must be either an aggregate
function or grouped by
Howie wrote:
> 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@toodarkpark.org> URL: http://www.toodarkpark.org
> "Oh my god, they killed init! YOU BASTARDS!"
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1998-10-20 17:39 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-10-20 16:59 count(*) and group by's... Howie <caffeine@toodarkpark.org>
1998-10-20 17:39 ` David Hartwig <daveh@insightdist.com>
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