我的表是:PHP的MySQL的匹配和返回值
studens_exam_answers_tbl
----------------------------------------------------
exam_id | question_id | student_id | student_answer
----------------------------------------------------
10 1 6 1
10 2 6 4
10 3 6 3
10 4 6 0
10 5 6 5
10 1 5 1
10 2 5 2
10 3 5 2
10 4 5 5
10 5 5 5
question_poll__tbl
--------------------------------------------------------------------------------
question_id | question | option_1 | option_2 | ....| option_5 |correct_answer
--------------------------------------------------------------------------------
1 .... .... .... ... .... 5
2 .... .... .... ... .... 2
3 .... .... .... ... .... 3
4 .... .... .... ... .... 4
5 .... .... .... ... .... 1
我想匹配与SQL正确答案的学生的答案。如果学生的答案是正确的,那么这是真的,否则就是错误的。如果student_answer为0'空'。
我该怎么办?
你想这样做SQL手段?您想要在studens_exam_answers_tbl中添加另一列以存储true或false。 – Lakshmi
你有没有试过任何查询? –
加入和比较,它并不难...... – Shomz