Received: from u1.abs.net (root@u1.abs.net [207.114.0.131]) by hub.org (8.8.8/8.8.8) with ESMTP id PAA16883 for ; Tue, 20 Oct 1998 15:53:53 -0400 (EDT) (envelope-from daveh@insightdist.com) Received: from insightdist.com (nobody@localhost) by u1.abs.net (8.9.0/8.9.0) with UUCP id NAA22916 for pgsql-sql@postgreSQL.org; Tue, 20 Oct 1998 13:47:47 -0400 (EDT) X-Authentication-Warning: u1.abs.net: nobody set sender to insightdist.com!daveh using -f Received: from ceodev by insightdist.com (AIX 3.2/UCB 5.64/4.03) id AA38936; Tue, 20 Oct 1998 13:35:15 -0400 Received: from daveh by ceodev (AIX 4.1/UCB 5.64/4.03) id AA61778; Tue, 20 Oct 1998 13:35:15 -0400 Message-Id: <362CCAB8.480ECB64@insightdist.com> Date: Tue, 20 Oct 1998 13:39:04 -0400 From: David Hartwig Organization: Insight Distribution Systems X-Mailer: Mozilla 4.05 [en] (Win95; I) Mime-Version: 1.0 To: Howie Cc: pgsql-sql@postgreSQL.org Subject: Re: [SQL] count(*) and group by's... References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 URL: http://www.toodarkpark.org > "Oh my god, they killed init! YOU BASTARDS!"