Really I am hard to get moodle enrolled and expired enrollment period of users report. I have tried many times to get this report so that I want to share you that mysql join query to run on database then get a report list with users which completed a course grade,user name,eamila ddress.
Here is the MYSQL Query:
SELECT c.shortname AS CourseName, CONCAT(mu.firstname, ‘ ‘, mu.lastname) AS fullname,mu.email as userEmailAddress, gg.finalgrade AS finalgrade
FROM mtl_grade_items AS gi
INNER JOIN mtl_course c ON c.id = gi.courseid
LEFT JOIN mtl_grade_grades_history AS gg ON gg.itemid = gi.id
INNER JOIN mtl_user AS mu ON gg.userid = mu.id
WHERE gi.itemtype = ‘course’
ORDER BY c.id asc
I hope it is help to you. Please share your thoughts.