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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-04-02 : 09:13:51
|
| Chris writes "Trying to graph the results of the answers to a list of survey questions...The survey can be taken x amount of times.There are 10 questions.Each question can have 1 to 5 answers.There are three tables...tblQuestions, tblAnswers and tblResponses (w/questionID, answerID)I need to find...# times each question has been answered.# of times each answer within each question has been chosen (including 0's)...which should add up to the previous number." |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-04-02 : 09:20:44
|
| Try something on these linesselect q.questionid, count(*), sum( case r.response when 0 then 1 else null end)from tblQuestion Qinner join tblAnswers AA.questionid=q.questionidleft Join tblResponse ron r.questionid=a.questionid and r.answerid=a.answeridgroup by q.questionid-------------------------------------------------------------- |
 |
|
|
|
|
|