Received: from slip1.raccoon.com (slip1.raccoon.com [165.90.135.16]) by hub.org (8.9.3/8.9.3) with ESMTP id VAA47777 for ; Thu, 3 Jun 1999 21:53:42 -0400 (EDT) (envelope-from perdue@raccoon.com) Received: from timnt (tim.desmoinesnet.com [165.90.140.11]) by slip1.raccoon.com (8.8.7/8.8.7) with SMTP id UAA09582 for ; Thu, 3 Jun 1999 20:48:20 -0500 Message-ID: <001801beae2c$354dd580$0b8c5aa5@timnt.weather.net> Reply-To: "Tim Perdue" From: "Tim Perdue" To: Subject: Group By Dilemma Date: Thu, 3 Jun 1999 20:47:30 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Hello, I am trying to do a GROUP BY so that I can get a count of messages with the same subject. The problem is, the optimizer won't let me group by just one column, when I am selecting several columns. I suppose Postgres doesn't know which rows to leave out and which ones to display, but I'm hoping someone can offer a solution.... SELECT fld_mailid, fld_mail_date, fld_mail_is_followup, fld_mail_from, fld_mail_subject, <-- Group only on this, so I can get a count count(*) FROM tbl_mail_archive WHERE fld_mail_list=1 AND fld_mail_year=1999 AND fld_mail_month=06 group by fld_mail_subject ORDER BY fld_mail_date DESC LIMIT 26 OFFSET 0; Tim Perdue PHPBuilder.com / GotoCity.com / Geocrawler.com