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