pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manfred Koizar <mkoi-pg@aon.at>
To: Len Morgan <len-morgan@crcom.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: What's wrong with this group by clause?
Date: Fri, 14 Mar 2003 11:38:30 +0100
Message-ID: <fhb37vsiacbvl4u9tqai03p806p28q3rej@4ax.com> (raw)
In-Reply-To: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net>
References: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net>

On Thu, 13 Mar 2003 01:34:34 -0600, "Len Morgan"
<len-morgan@crcom.net> 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



view thread (8+ messages)  latest in thread

Message-ID: <fhb37vsiacbvl4u9tqai03p806p28q3rej@4ax.com>
Permalink:  ../fhb37vsiacbvl4u9tqai03p806p28q3rej@4ax.com/
Also on:    postgresql.org/message-id/fhb37vsiacbvl4u9tqai03p806p28q3rej@4ax.com

 · 

reply

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: mkoi-pg@aon.at, len-morgan@crcom.net
  Subject: Re: What's wrong with this group by clause?
  In-Reply-To: <fhb37vsiacbvl4u9tqai03p806p28q3rej@4ax.com>
  References: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net> <fhb37vsiacbvl4u9tqai03p806p28q3rej@4ax.com>

* 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