Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 9th, 2004, 12:59 PM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
e. Very bad
d. N/A


2. How do you rate this article?
a. Excellent
b. Very good
c. Good
d. Not very good
e. Very bad
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%
e. Very bad 30 25%
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%
e. Very bad 30 25%
                ===== ====
                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%
c. Bad 40 40%
               ===== ====
                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
             AnswersTable ON ResultsTable.AnswersTableID = answers.AnswersTableID
WHERE (answersTable.answerdesrcription = 'Excellent' OR
                      answersTable.answersdescription = 'Very good') AND (answersTable.QuestionID = 1)

BTW, I have 3 tables: QuestionsTable (store questions), AnswersTable (store answers) and ResultsTable (store the results)

3. Leave the third choice alone (Good) since they don't want to combine with with anything else.

4. Write another SQL Query to combine the last 2 options ('Not very good' and 'Very bad')

5. Write one more Query to sum all the answers except 'N/A' and write some other queries to get the percentages.

I would appreciate if you can share with me some ideas on how this could be done in a simplier way.




Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Language survey jminatel Perl 0 August 28th, 2007 09:50 PM
Language Survey jminatel Beginning PHP 0 August 28th, 2007 09:48 PM
Survey Engine anitafn2005 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 February 18th, 2007 01:56 AM
Survey App Question flsimmons BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 7 May 26th, 2006 03:14 PM
how can i handle 3 question in a survey blueguy Classic ASP Basics 6 October 24th, 2004 06:41 PM



All times are GMT -4. The time now is 08:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.