Results 1 to 1 of 1
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 ...
- 07-11-2006 #1Linux Newbie
- Join Date
- Apr 2005
- Location
- Charlottesville, VA
- Posts
- 175
SQL Nightmare
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:
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.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;
Thank you so much in advance.
sxeraverx---sxeraverx---
Linux without a C Compiler is like eating Spaghetti with your mouth sewn shut. It just doesn't make sense.


Reply With Quote
