Moodle fetch Student Grades


To fetch student’s grade from Moodle database you can use this query


SELECT u.firstname AS `First Name` , u.lastname AS `Last Name` , AS Email, c.idnumber AS `Course Acronym` , c.fullname AS Course, ROUND( gg.finalgrade, 2 ) Grades, AS City, AS Country, FROM_UNIXTIME( gi.timemodified ) `Grading Date`
FROM mdl_course AS c
JOIN mdl_context AS ctx ON = ctx.instanceid
JOIN mdl_role_assignments AS ra ON ra.contextid =
JOIN mdl_user AS u ON = ra.userid
JOIN mdl_grade_grades AS gg ON gg.userid =
JOIN mdl_grade_items AS gi ON = gg.itemid
WHERE gi.courseid =
AND gi.itemtype = ‘course’
AND c.idnumber IN (‘C101’, ‘C102’, ‘C103’, ‘C104’, ‘C105’)

ORDER BY c.idnumber





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s