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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select statement SQL query

Author  Topic 

danscan
Starting Member

1 Post

Posted - 2001-08-03 : 11:56:45
I have a table of answers given for a test.
with survey_ID's corresponding to the question # and the Answer given. I want to get all the answers for the survey numbers that answer question# 4 = addmissions. From this set of survey ID get all the questions and answers.

============sql============
SELECT DISTINCT tblAnswered.TEST_number, tblAnswered.Survey_ID, tblTest.Category_Id, tblTest.Test_Q_Number, tblAnswered.answer
FROM (tblQuestion INNER JOIN tblAnswered ON tblQuestion.Question_ID = tblAnswered.Question_ID) INNER JOIN (tblCategory INNER JOIN tblTest ON tblCategory.Category_Id = tblTest.Category_Id) ON tblQuestion.Question_ID = tblTest.QuestionID
WHERE
(((tblAnswered.survey_ID)=
(Select tblanswered.Survey_ID from tblAnswered where tblanswered.Question_ID=4 and tblanswered.Answer='admissions' )))
ORDER BY tblAnswered.Survey_ID, tblTest.Category_Id, tblTest.Test_Q_Number;

=========end sql===============

Thanks for the help.

   

- Advertisement -