我在Moodle中安装了插件Configurable Reports以获取一些自定义报告。现在我想检索课程名称,测验问题,测验答案,用户名字和姓氏以及成绩结果。
我做的是:
SELECT c.shortname AS "Cursus",
q.name AS "Quiz",
h.name AS "Vraag",
o.text AS "Antwoord",
u.firstname AS "Naam",
u.lastname AS "Achternaam",
gg.userid AS "Resultaat"
FROM prefix_choice AS h
JOIN prefix_course AS c ON c.id AND c.id = %%COURSEID%%
JOIN prefix_choice_answers AS a ON h.id = a.choiceid
JOIN prefix_quiz AS q ON q.name
JOIN prefix_choice_options AS o ON a.optionid = o.id
JOIN prefix_user AS u ON a.userid = u.id
JOIN prefix_grade_grades AS gg ON gg.userid
WHERE c.id = %%COURSEID%%
但不知怎的,它显示了Moodle上所有模块的所有测验问题和答案。我只是想从我现在所在的课程中检索这些数据。我错过了什么吗?
答案 0 :(得分:0)
我不确定,而不是这个:
JOIN prefix_course AS c ON c.id AND c.id = %%COURSEID%%
尝试这样做:
JOIN prefix_course AS c ON c.id = %%COURSEID%%
我认为可能是因为'ON c.id'他正在采取所有的ids