Answer table to store the examinee answer information, namely the examinee if do some of the subject, the paper is inserted into the answer these questions and answer table, each table in the main fields as follows,
Kaoshi_single table: singleid ssubject, Sanswer
Kaoshi_examquestions table: examquestionid, questionid, questiontype examid
Kaoshi_answer table: answerid xuehao, examid, answer, questionid, questiontype
Now I want to query a student's test answers as well as the original questions and correct answers, the SQL to select * from kaoshi_single s join kaoshi_examquestions e join kaoshi_answer where a a.q uestionid=e.q uestionid and a.q uestiontype='single' and s.s ingleid=e.q uestionid and e.q uestiontype='single' and e.e xamid='" + examid + "' and a.x uehao='" + xuehao + "' ";
Before and after the last line of the plus sign examid and xuehao as variables, so this statement is a problem, if the students do questions a topic to do (blank), so the subject of reading information, there is no insert the answer sheets, so by the SQL statement to see the answer when the subject is not displayed, now I want to have a test of single topic information and students' problem solving information are found out, even if the student didn't do, is to list the title, just a student answer shows is empty, according to my analysis should be with a left outer join, but I can't be with the following left outer join,
SQL="select * from kaoshi_single s left join kaoshi_examquestions e on s.s ingleid=e.q uestionid left join kaoshi_answer a on a.q uestionid=e.q uestionid where a.q uestiontype='single' and e.q uestiontype='single' and e.e xamid='" + examid +"' and a.x uehao='" + xuehao + "' ";
Ask ace to how to write, best can also briefly explain, thank you.
CodePudding user response:
Have some good ideas?CodePudding user response:
@ February 16 @ shoppo0505