I am using Moodle 2.4.
Thank you for your help .
I just tryed it out and I get all enrolled user in a course and noting in the FinalGrade column.
You still use enrol and user_enrollments database.
Does it mean it is not possible to get historical grades of a student if he is unenrolled in a course ?
For exemple, one student, who's not enrolled anymore in a course.
I would like to get his final result called "Note finale du cours" in the "Sommatif" category.
In Moodle 1.9 It was easy cause there was not any history tables :
SELECT ROUND(mdl_grade_grades.finalgrade) AS final_grade, mdl_grade_grades.finalgrade, mdl_course.fullname, itemname FROM mdl_grade_gradesJOIN mdl_user ON mdl_grade_grades.userid = mdl_user.id JOIN mdl_grade_items ON mdl_grade_grades.itemid = mdl_grade_items.id JOIN mdl_course ON mdl_grade_items.courseid = mdl_course.idWHERE userid = '$user->id' and grademax = 100 and (itemtype = 'mod' OR itemtype = 'category') and itemname = 'Note finale du cours'"