Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jenese
Starting Member
6 Posts |
Posted - 2002-09-24 : 12:11:08
|
| Hi, I'm looking for tips, links & suggestions. Would appreciate any info. I'm developing an online survey using ASP and a SQL database. I don't have any problems connecting to the database or writing code... but I've never done a survey before. My first question is how to calculate the survey results?My second question ... how best to organize the tables? I'm assuming that how I organize the tables will make a difference in how hard/easy it is to calculate the results.... is this true?(My first goal is just to be able to collect the results and then calulate the percentages of answers. Eventaully, it'd be good to have the survey be created by an admin inputing the survey and it's questions, but that can wait) This is the structure I have so far:T_surveysid, survey_name, start_date, end_date, status, number_of_questionsT_questionsid, survey_id, question_text, display_orderT_question_optionsid, survey_id, question_id, option_type, option_text, display_orderT_responsesid, survey_id, question_id, member_id, response, comment, date_enteredthis set up would mean that a checkbox type question could have "1,3,6,7" in the response field, which could make this way of calculating the results harder:select _something_from T_responseswhere survey_id = @survey_id and question_id = @question_id ...out of time for now! will come back to this.Thanks. |
|
|
jenese
Starting Member
6 Posts |
Posted - 2002-09-24 : 17:11:49
|
| Ok, the three calculations needed, in rough form:1) Get __ total survey responsesselect count(*) as total_responsesfrom T_responses where survey_id = @survey_id and question_id = @question_id 2) Get __ number of responders who selected ___ optionselect count(*) as response_Afrom T_responses where survey_id = @survey_id and question_id = @question_id and T_responses.response = @option_value (found in T_question_options.option_value, maybe it'd be easier to loop though available options for each question...)3) Get __ percentage of responders who selected ___ optionpercent_response_A = response_A / total_responses |
 |
|
|
|
|
|
|
|