X-Original-To: pgsql-sql@postgresql.org Received: from email06.aon.at (WARSL401PIP3.highway.telekom.at [195.3.96.75]) by postgresql.org (Postfix) with SMTP id 35FED47590C for ; Fri, 14 Mar 2003 05:39:29 -0500 (EST) Received: (qmail 19454 invoked from network); 14 Mar 2003 10:39:30 -0000 Received: from m161p004.dipool.highway.telekom.at (HELO cantor) ([62.46.10.4]) (envelope-sender ) by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 14 Mar 2003 10:39:30 -0000 From: Manfred Koizar To: "Len Morgan" Cc: Subject: Re: What's wrong with this group by clause? Date: Fri, 14 Mar 2003 11:38:30 +0100 Message-ID: References: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net> In-Reply-To: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net> X-Mailer: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/358 X-Sequence-Number: 12397 On Thu, 13 Mar 2003 01:34:34 -0600, "Len Morgan" wrote: >>GROUP BY > > field1, > > field2, > >name; >I think the problem is that you don't have a column to group on. field1, field2, and name are the grouping columns. >Try adding >SELECT ....,count(*).... so that there is an aggregate of some kind. You don't need an aggregate in a GROUP BY query. A SELECT ... GROUP BY without any aggregate behaves like SELECT DISTINCT. There's nothing wrong with it. Performance might be a different story. BTW, Franco's problem has been recognised as a bug and a patch has already been published (cf. Tom Lane's mail in this thread). Servus Manfred