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 |
computerforce
Starting Member
10 Posts |
Posted - 2007-02-05 : 15:49:01
|
I'll try to simplify the problem as much as I can.There's survey. It has different types of question answer pairs, but the problem is in Multiple Choices, Multiple Answers questions, where user can choose, for example 3 checkboxes from 5 at the web form, for the question.I am emphasizing three tables:tbl_questionsIDquestion (primary)question (textual question)tbl_answersIDanswer (primary)IDquestion (foreign,to table tbl_questions)answer (textual answer)tbl_resultsIDresult (primary)IDquestion (foreign, to tbl_question)result (string based on CSV, may contain few IDanswers, because visitor may choose few checkboxes, for example it can be "4,6,7")Inside those tables are data (I'll put here just two questions):Example:tbl_questionsIDquestion_question1_________Which OS do you use?2_________Which databases do you use?tbl_answersIDanswer_IDquestion_answer1________1_________Windows2________1_________Linux3________1_________Mac OS4________2_________SQL Server5________2_________MS Access6________2_________MySQL7________2_________Oracle8________2_________Other9________2_________No, I do not use databasestbl_resultsIDresult_IDquestion_results........23_______1________1,224_______2________4,6,7........Is there a possibility to make query, using columns, but also the data inside the CSV format in results (varchar or char) column?Result of the query would be:IDquestion_IDanswer_answer1_________1________Windows1_________1________Linux2_________4________SQL Server2_________6________MySQL2_________7________OracleFurther queries based on this query should be able to make statistics (GROUP BY). |
|
|
|
|
|
|