SQL query for Courses Enrolment on Moodle

后端 未结 5 602
清歌不尽
清歌不尽 2020-12-30 09:31

I was looking for the proper SQL queries for retrieving all students enrolled in a certain course, or all courses a certain student has enrolled in, on Moodle

5条回答
  •  抹茶落季
    2020-12-30 10:29

    The first query will give you everyone regardless of their role - the table is used to store the type of enrolment - http://docs.moodle.org/26/en/Enrolment_plugins

    The second one will only give you students - so will be more useful.

    They are the same results because only students have been assigned to the courses.

    If you go to a course and enrol users. Then at the top of the popup window choose assign roles = teacher and enrol a user. So on the course you will now have student(s) and a teacher

    Then re-run the queries, the second query will have fewer results because it will only have students.

提交回复
热议问题