Skip site navigation (1) Skip section navigation (2)

problem - group by

From: Dusan PESL <D(dot)PESL(at)seznam(dot)cz>
To: pgsql-novice(at)postgresql(dot)org
Subject: problem - group by
Date: 2007-05-12 08:26:17
Message-ID: 72.444-1127-73735402-1178958377@seznam.cz (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,

in SQLite this query is posible:

SELECT acount/1000, SUM(values)  FROM acounts
GROUP BY acount/1000

this very simple and elegant way to get groups of common acounts, Unfortunately Postgres doesn't alow "GROUP BY acount/1000" - only "GROUP BY acount", which is not the same.

I know, there are several ways, how to solve this problem, but the metod "GROUP BY acount/1000" seems to be the most elegant. Can anyone help me?

Thanks Dusan

Responses

pgsql-novice by date

Next:From: Dusan PESLDate: 2007-05-13 14:37:26
Subject: problem - group by
Previous:From: Tom LaneDate: 2007-05-12 03:58:38
Subject: Re: Executing dynamic queries without functions / procedures

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group