pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Len Morgan <len-morgan@crcom.net>
To: pgsql-sql@postgresql.org
Subject: Re: What's wrong with this group by clause?
Date: Thu, 13 Mar 2003 01:34:34 -0600
Message-ID: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net> (raw)

From: Franco Bruno Borghesi <franco@akyasociados.com.ar>
>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





view thread (8+ messages)  latest in thread

Message-ID: <00a201c2e932$fee5b9e0$0300a8c0@kttk.net>
Permalink:  ../00a201c2e932$fee5b9e0$0300a8c0@kttk.net/
Also on:    postgresql.org/message-id/00a201c2e932$fee5b9e0$0300a8c0@kttk.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: len-morgan@crcom.net
  Subject: Re: What's wrong with this group by clause?
  In-Reply-To: <00a201c2e932$fee5b9e0$0300a8c0@kttk.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