Ok... I'm attempting to find out the test_id numbers of tests that were passed but have more than 10 questions unanswered.
There are 2 tables. Test_questions contains all the tests and individual answers to each question therein. Any unanswered question will have answer_id_given as a NULL. The Tests table contains the result of the test, who took it, what time, ect.. but all I'm interested in is test_id (which should match with what is in test_questions) and final_result.
First thing I did was:
Next I was going to attempt to count the number of test_id that was greater than 10 where the corresponding test_id in the Tests table had a final_result of passed. But I can't seem to write that SQL query correctly
What I have so far (that doesn't work)
There are 2 tables. Test_questions contains all the tests and individual answers to each question therein. Any unanswered question will have answer_id_given as a NULL. The Tests table contains the result of the test, who took it, what time, ect.. but all I'm interested in is test_id (which should match with what is in test_questions) and final_result.
First thing I did was:
This produced a table containing every unanswered question (154k+ rows, yikes!)select * into testquestions_temp from testquestions where answer_id_given is null
Next I was going to attempt to count the number of test_id that was greater than 10 where the corresponding test_id in the Tests table had a final_result of passed. But I can't seem to write that SQL query correctly
What I have so far (that doesn't work)
select * FROM testquestions_temp AS TQT JOIN
Tests AS T ON TQT.test_id = T.test_id
where (T.final_status = 'passed') and having (COUNT(TQT.test_id) > '10')