Re: devide and summarize sql result (all) - Mailing list pgsql-general

From Beena Emerson
Subject Re: devide and summarize sql result (all)
Date
Msg-id CAOG9ApEsxV4RrS9Z2DbTp7v-=eisuimmo6cZ_-on84CJTHKpVA@mail.gmail.com
Whole thread Raw
In response to devide and summarize sql result (all)  ("Janek Sendrowski" <janek12@web.de>)
List pgsql-general
Hi Janek,

You can try:

=# SELECT name, perc/5*5 || '-' || perc/5*5+5 AS range, count(*) as matches FROM test GROUP BY name, perc/5 ORDER BY perc/5;
 name  | range  | matches 
-------+--------+---------
 franz | 75-80  |       1
 jason | 75-80  |       1
 franz | 80-85  |       1
 smith | 85-90  |       2
 smith | 95-100 |       2
(5 rows)



--
Beena Emerson

pgsql-general by date:

Previous
From: Robert James
Date:
Subject: Forcing materialize in the planner
Next
From: S H
Date:
Subject: Re: Commit problem in read-commited isolation level