Date a course was completed (v2.4)

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Constance Horne
Date a course was completed (v2.4)

I am creating SQL to export final grades for completed courses.

Where can I find the date a course was completed by a student?

Picture of Kimber Warden
Re: Date a course was completed (v2.4)
Group Particularly helpful Moodlers

Try prefix_course_completions.timecompleted

Picture of Constance Horne
Re: Date a course was completed (v2.4)

Thanks. I didn't know about this table at all.

For anyone that needs an export of grades, here is what I now have:

SELECT "CourseId"
, u.username
, u.firstname , u.lastname ,, u.department
, c.shortname AS CourseName
, ROUND(gg.finalgrade,2) as Grade
, FROM_UNIXTIME(cc.timecompleted) as DateCompleted
FROM mdl_grade_items AS gi
, mdl_course c
, mdl_grade_grades AS gg
, mdl_user AS u  
, mdl_course_completions as cc  
WHERE gi.itemtype = 'course'
AND = gi.courseid
AND  gg.itemid =
AND gg.userid =
and cc.userid =
and cc.course =  gi.courseid
and cc.timecompleted is NOT NULL