Group By Dilemma
От | Tim Perdue |
---|---|
Тема | Group By Dilemma |
Дата | |
Msg-id | 001801beae2c$354dd580$0b8c5aa5@timnt.weather.net обсуждение исходный текст |
Ответы |
Re: [SQL] Group By Dilemma
|
Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: