June 2017
Beginner to intermediate
368 pages
8h 31m
English
The ad-hoc database query plugin is supported by a great many reports (essentially, SQL queries) contributed by the Moodle community and freely available from https://docs.moodle.org/31/en/ad-hoc_contributed_reports. As an example, let's pull out a report of the number of enrollments of each course on our Moodle site (https://docs.moodle.org/31/en/ad-hoc_contributed_reports#Enrolment_count_in_each_Course). Here's the complete query:
SELECT c.fullname, COUNT(ue.id) AS Enroled FROM prefix_course AS c JOIN prefix_enrol AS en ON en.courseid = c.id JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id GROUP BY c.id ORDER BY c.fullname
As we are querying the database directly, we do need to pay attention to the efficiency of the ...
Read now
Unlock full access