X-Original-To: pgsql-sql@postgresql.org Received: from mail1.crcom.net (mail1.crcom.net [208.220.74.103]) by postgresql.org (Postfix) with ESMTP id A9438476351 for ; Thu, 13 Mar 2003 02:34:22 -0500 (EST) Received: from localhost (mail2.crcom.net [208.220.74.104]) by mail1.crcom.net (Postfix) with ESMTP id AAABF175E7 for ; Thu, 13 Mar 2003 01:34:23 -0600 (CST) Received: from mail1.crcom.net ([208.220.74.103]) by localhost (mail2.crcom.net [208.220.74.104:10024]) (amavisd-new) with ESMTP id 16757-02 for ; Thu, 13 Mar 2003 01:34:23 -0600 (CST) Received: from D77GW811 (unknown [208.239.25.9]) by mail1.crcom.net (Postfix) with SMTP id BDCB116700 for ; Thu, 13 Mar 2003 01:34:22 -0600 (CST) Message-ID: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net> From: "Len Morgan" To: Subject: Re: What's wrong with this group by clause? Date: Thu, 13 Mar 2003 01:34:34 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Archive-Number: 200303/354 X-Sequence-Number: 12393 From: Franco Bruno Borghesi >SELECT > 0 AS field1, > 0 AS field2, >name >FROM > people >GROUP BY > field1, > field2, >name; I think the problem is that you don't have a column to group on. Try adding SELECT ....,count(*).... so that there is an aggregate of some kind. Alternatively, you could use DISTINCT ON (field1,field2) field1,field2,name FROM ... although this is a Postgres specific extension of the SQL spec. Len Morgan