Judgey
August 21st, 2001, 03:49 AM
Good Morning Guru's,
Could somebody please switch the lights on for me on this one. I have been trying to get my head round subqueries without much success and I really want to learn how to do them, so so could anybody resolve this one for me so I can see how you do it.
Basically I have my first Query which groups together a list using the SQL statement below ;
SELECT TestAnswers.TestNumber, TestAnswers.QuestionNo, TestAnswers.AnsweredType FROM TestAnswers GROUP BY TestAnswers.TestNumber, TestAnswers.QuestionNo, TestAnswers.AnsweredType HAVING (((TestAnswers.TestNumber)=1644));
This gives the results as follows ;
TestNumber, QuestionNo, AnsweredType
1644 , 126 , 0
1644 , 131 , 0
1644 , 132 , 1
1644 , 145 , 2
I then need to perform a simple Count query on this just to return the number of each AnsweredType;
eg.
AnsweredType CountAnsweredType
0 2
1 1
2 1
I can't just do a count query in the first instance as there could be 6 records for each question so it inflates the count hence the need to do a GROUP BY Query first.
Please help . . . .
Quote of the Day;
Work is necessary for man. Man invented the alarm clock.
Could somebody please switch the lights on for me on this one. I have been trying to get my head round subqueries without much success and I really want to learn how to do them, so so could anybody resolve this one for me so I can see how you do it.
Basically I have my first Query which groups together a list using the SQL statement below ;
SELECT TestAnswers.TestNumber, TestAnswers.QuestionNo, TestAnswers.AnsweredType FROM TestAnswers GROUP BY TestAnswers.TestNumber, TestAnswers.QuestionNo, TestAnswers.AnsweredType HAVING (((TestAnswers.TestNumber)=1644));
This gives the results as follows ;
TestNumber, QuestionNo, AnsweredType
1644 , 126 , 0
1644 , 131 , 0
1644 , 132 , 1
1644 , 145 , 2
I then need to perform a simple Count query on this just to return the number of each AnsweredType;
eg.
AnsweredType CountAnsweredType
0 2
1 1
2 1
I can't just do a count query in the first instance as there could be 6 records for each question so it inflates the count hence the need to do a GROUP BY Query first.
Please help . . . .
Quote of the Day;
Work is necessary for man. Man invented the alarm clock.