Thread: Survey Question! View Single Post
April 9th, 2004, 12:59 PM
 NeedASP Registered User Join Date: Apr 2004 Location: , , . Posts: 7 Thanks: 0 Thanked 0 Times in 0 Posts
Survey Question!

Dear experts,

My survey has somewhat 50 questions.
Each question has 6 multiple choices answers.
These choices are the same for all 50 questions.
Fx:
Q1. How do you rate your company performance?
a. Excellent
b. Very good
c. Good
d. Not very good
d. N/A

a. Excellent
b. Very good
c. Good
d. Not very good
d. N/A

and so on.

Requirement #1: Display the total voted for each answer for each question. This is done.
Here is an example of what the result looks like:

Q1. How do you rate your company performance? 120
Total voted Percentage
a. Excellent 35 21.17%
b. Very good 20 16.67%
c. Good 5 4.17%
d. Not very good 10 8.33%
d. N/A 20 16.67%
===== =====
120 100%
Requirement #2: Display the total voted for all choices except 'N/A' choice. This is done too.

Here is an example of what the result looks like:

Q1. How do you rate your company performance? 120
Total voted Percentage
a. Excellent 35 21.17%
b. Very good 20 16.67%
c. Good 5 4.17%
d. Not very good 10 8.33%
===== ====
100 100%
I just used a WHERE clause to remove the last choice 'N/A'
and re-calculate the numbers a bit.

Requirement #3: Display the total voted for all choices except 'N/A' with this format: (And this is NOT done).

Q1. How do you rate your company performance? 120
Total voted Percentage
a. Very good 55 55%
b. OK 5 5%
===== ====
100 100%

55 (35 + 25). They want to combine 'Excellent' and 'Very good'
5. THey want to leave this one alone
40 (30+ 10). They want to combine 'Not very good' and 'Very bad'

Does anyone have any idea on how this could be done?

This is my logic but I am not sure this is the best option:

1. Hard code the choices: 'Very good', 'OK' and 'Bad' insteads of populating them from db using a Loop. Also, note that the choice 'OK' is what they come up with insteads of 'Good'.

2. Write an SQL query to calculate the sum of 'Excellent' and 'Very good' to make up the 'Very good' choice. Something like,
SELECT SUM(ResultsTable.total) AS Very good
FROM ResultsTable INNER JOIN