Hi John,

Here's some code a guy in our office gave me a while back for this:
----------------------------
For example, if I was retrieving the responses from a Yes/No survey, I could
run the following:

SELECT column , Count(*) FROM table
GROUP BY column

The results could be:

column
-------- -------
Yes      432
No       165
----------------------------
Best,
John

-----Original Message-----
From: John Allred [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 17, 2000 1:02 PM
To: CF-Talk
Subject: Setting up a poll database


I'm trying to create a poll. Since I want to use radio buttons on the
form, I'm creating one field for each category of information that uses
the numbers 1 through 5 to allow the user to make one selection only in
each category.

The problem I'm having is figuring out how I'm going to count the
responses and display them. If each entry were in a different db field,
I could do a count on each field and only use one SELECT query. But with
different numbers in the same field, all I can think of is to use
multiple queries with each one having its own WHERE clause.

This seems like poor form. Does anyone have advice on how to proceed? If
I get into thousands of responses, I don't want the queries to bog down.
If you suggest structures, please assume I know nothing about them
(which is true, BTW).

TIA,
--John
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to