From: Tim Perdue <perdue@raccoon.com>
To: pgsql-sql@hub.org
Subject: Group By Dilemma
Date: Thu, 3 Jun 1999 20:47:30 -0500
Message-ID: <001801beae2c$354dd580$0b8c5aa5@timnt.weather.net> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: perdue@raccoon.com, pgsql-sql@hub.org
Subject: Re: Group By Dilemma
In-Reply-To: <001801beae2c$354dd580$0b8c5aa5@timnt.weather.net>
References: <001801beae2c$354dd580$0b8c5aa5@timnt.weather.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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