I'm pretty new at moodle and would like to get the last enrolments of the system somehow by sql.
Means, I don't want to get who is enrolled in a certain course, but what are the last 20 enrolments over the whole system. I want to create social bubbles which pops up on the start pages showing "User X has enrolled to course y 3 min. ago. Book the course here (link)"
If someone visits the custom enrolment page, the bubble should just show the information of the last 20 users how enrolled to the course.
I could use the API funcktions like core_course_get_courses, core_enrol_get_enrolled_users or core_user_get_users but API is slower than a SQL that just has e.g. 20 datasets as a result.
THank you for your help