I'm trying to generate a php based report based on some postgres SELECT statements...

Basically I have some (poorly designed) data that looks like this (all boolean):

Fields in table: touring,road,mountain,recumbent,etc...

Some are set to TRUE, some aren't...

What I want is a listing of the TRUE counts for each field, sorted on the COUNT value, something like:


41    Touring
23    Mountain
12    Road
etc.


So if I run this command:

select count(interest_touring) as cnt_touring from contacts where interest_touring;

My thinking is that I can run the command, assign variables, then INSERT the values to a new table, then just report on the table.

How do I assign the variables? Looking at the Postgres docs they have some sort of convoluted Function declarations going on.

I'm not married to the idea of doing things this way, so I'm open to suggestions as well...


--
Matthew S. Jarvis
IT Manager
Bike Friday - "Performance that Packs."
www.bikefriday.com
541/687-0487 x140
[EMAIL PROTECTED]
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to