diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 751f6db6b70..f0b08766164 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -488,7 +488,7 @@ class default_questiontype { $question->options->answers = $DB->get_records_sql(" SELECT qa.*, qax." . implode(', qax.', $extra_answer_fields) . " FROM {question_answers} qa, {$answer_extension_table} qax - WHERE qa.questionid = ? AND qax.answerid = qa.id", array($question->id)); + WHERE qa.question = ? AND qax.answerid = qa.id", array($question->id)); if (!$question->options->answers) { echo $OUTPUT->notification("Failed to load question answers from the table $answer_extension_table for questionid " . $question->id);