List of students per course

List of students per course

by A. A. -
Number of replies: 1

Hi, how could I get a list of students per course?

And how to get the list for the current course?

Thanks

Antonio

Average of ratings: -
In reply to A. A.

Re: List of students per course

by A. A. -

Hi,

digging into the moodle database, I managed to write a SLQ query to get a list of courses with its students.

This is the query:

SELECT pc.shortname, pu.lastname FROM
prefix_course AS pc 
JOIN prefix_enrol as pe
ON pc.id=pe.courseid
JOIN prefix_user_enrolments AS pue
ON pe.id=pue.enrolid
JOIN prefix_user AS pu
ON pue.userid=pu.id

ORDER BY pc.shortname

This shows all the courses with its enrolled users.

To get only one course I defined a filter on the course.

When the report starts, it initially shows a dropdownlist with the first selection as All courses, showing all courses with its enrolled users.

But when I choose one course the report keeps showing all the courses. So actually the filter seems not working at all.

Any suggestion?