Hey, all

Is it possible (and feasible) to create a distribution with postgresql commands? I have a table called 'cif' that has columns 'cifid', 'r_factor', and 'progid' (cifid being the primary key, and r_factor being a real), and I would like to extract the number of entries that have an r_factor of less than .025, between .025 and .05, between .05 and .075, and greater than .075 (for each progid, if possible). Is this possible to do? Is it feasible to do? Or is it easier to run each sql statement seperately?

I know that to do it for a given range and a given progid, I can use the statement:
Code:
SELECT sum(count) FROM (SELECT DISTINCT count(1), r_factor FROM cif WHERE
progid = 1 GROUP BY r_factor ORDER BY r_factor) AS foo WHERE r_factor < .025;
which gives me the number of entries where r_factor is less than .025 and where progid = 1, but I can't figure out how to make it give me all of the cases at once. Btw, I'm using Postgresql v7.3.10-RH.

Thank you so much in advance.

sxeraverx