Os comandos a seguir exibe a lista de alunos que responderam as enquetes.
Filtro apenas nas tabelas de tentativa mdl_questionnaire_attempts e mdl_questionnaire_response
Testado em Março/2022 no Moodle 3.11.2 Versão do questionnaire: 3.10.1 (Build - 2021080400)
SELECT r.id,r.questionnaireid,r.submitted,r.complete,r.grade,r.userid FROM mdl_questionnaire_response r WHERE r.id > 0
Versão anterior (Testado em: Maio/2017 - 2017050101 e Dezembro/2013 - 2013122200)
SELECT r.id,r.survey_id,r.submitted,r.complete,r.grade,t.userid,t.timemodified FROM mdl_questionnaire_response r LEFT JOIN mdl_questionnaire_attempts t ON r.id=t.rid WHERE r.id > 0
Filtro com junção na tabela de questionário, enquete, curso, categoria de curso e usuário
Testado em Março/2022 no Moodle 3.11.2 Versão do questionnaire: 3.10.1 (Build - 2021080400)
SELECT r.id, qs.id AS mdlsurveyid,qs.name AS surveyname,qs.title AS surveytitle,q.id AS mdlquestionnaireid,q.name AS questionnairename, q.intro AS questionnaireintro,q.qtype AS questionnaireqtype,q.opendate AS questionnaireopendate,q.closedate AS questionnaireclosedate,q.resume AS questionnaireresume,q.grade AS questionnairegrade,q.completionsubmit AS questionnairecompletionsubmit, q.course AS mdlcourseid,c.fullname AS coursename,ct.id AS mdlcoursecategoryid,ct.name AS coursecategoryname,ct.path AS coursecategorypath,r.submitted,r.complete,r.grade,r.submitted,r.userid AS mdluserid,u.firstname AS userfirstname,u.lastname AS userlastname,u.email AS useremail FROM mdl_questionnaire_response r INNER JOIN mdl_questionnaire q ON r.questionnaireid =q.id INNER JOIN mdl_questionnaire_survey qs ON qs.id=q.sid INNER JOIN mdl_course c ON c.id=q.course LEFT JOIN mdl_course_categories ct ON ct.id=c.category LEFT JOIN mdl_user u ON r.userid=u.id WHERE r.id > 0
Versão anterior (Testado em: Maio/2017 - 2017050101 e Dezembro/2013 - 2013122200)
SELECT r.id, r.survey_id AS mdlsurveyid,qs.name AS surveyname,qs.title AS surveytitle,t.qid AS mdlquestionnaireid,q.name AS questionnairename, q.intro AS questionnaireintro,q.qtype AS questionnaireqtype,q.opendate AS questionnaireopendate,q.closedate AS questionnaireclosedate,q.resume AS questionnaireresume,q.grade AS questionnairegrade,q.completionsubmit AS questionnairecompletionsubmit, q.course AS mdlcourseid,c.fullname AS coursename,ct.id AS mdlcoursecategoryid,ct.name AS coursecategoryname,ct.path AS coursecategorypath,r.submitted,r.complete,r.grade,t.timemodified,t.userid AS mdluserid,u.firstname AS userfirstname,u.lastname AS userlastname,u.email AS useremail FROM mdl_questionnaire_response r LEFT JOIN mdl_questionnaire_attempts t ON r.id=t.rid LEFT JOIN mdl_questionnaire_survey qs ON qs.id=r.survey_id LEFT JOIN mdl_questionnaire q ON t.qid=q.id LEFT JOIN mdl_course c ON c.id=q.course LEFT JOIN mdl_course_categories ct ON ct.id=c.category LEFT JOIN mdl_user u ON t.userid=u.id WHERE r.id > 0