Re: What's wrong with this group by clause? - Mailing list pgsql-sql

From Len Morgan
Subject Re: What's wrong with this group by clause?
Date
Msg-id 00a201c2e932$fee5b9e0$0300a8c0@kttk.net
Whole thread Raw
In response to What's wrong with this group by clause?  (Franco Bruno Borghesi <franco@akyasociados.com.ar>)
Responses Re: What's wrong with this group by clause?  (Manfred Koizar <mkoi-pg@aon.at>)
List pgsql-sql
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




pgsql-sql by date:

Previous
From: "Ian Harding"
Date:
Subject: Re: Create function statement with insert statement
Next
From: Larry Rosenman
Date:
Subject: Re: nearest match