Hello everyone. I am trying to get a Formative submissions report that shows student id, firstname, lastname, submission name and the feedback for the submission from the tutor. All the submissions are created under a specific category. I'm not getting the correct results.
Moodle version: 3.4.2+
The following is the query I have written.
SELECT u.`username` AS 'Student ID',u.`firstname` AS 'Firstname',u.`lastname`AS 'Lastname',
asn.`name` AS 'Assignment',
c.`fullname`,
mcc.`name` AS 'category',
afc.`commenttext`AS 'Teacher Feedback'
FROM mdl_assign AS asn
JOIN mdl_course AS c ON c.`id`=asn.`course`
JOIN mdl_assign_grades AS ag ON ag.`assignment`= asn.`id`
JOIN mdl_assign_submission AS mas ON mas.`assignment`=asn.`id`
JOIN mdl_user AS u ON u.`id`=mas.`userid`
JOIN mdl_assignfeedback_comments AS afc ON afc.`assignment`=ag.`assignment`
JOIN mdl_course_categories AS mcc ON mcc.`id`= c.`category`
WHERE mcc.`name`='Category name' AND mcc.`id`='category id'
GROUP BY u.`username`
Can anyone please tell me how to get the correct results.
Thanks in advance