Groups option.

Re: Groups option.

by Emma Richardson -
Number of replies: 0
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Maybe this will help - it is an enrollment report that includes groups..

SELECT DISTINCT c.shortname, usr.firstname, usr.lastname, usr.username, usr.email, groups.name
FROM prefix_course AS c
INNER JOIN prefix_context AS cx ON c.id = cx.instanceid
AND cx.contextlevel = '50'
INNER JOIN prefix_role_assignments AS ra ON cx.id = ra.contextid
INNER JOIN prefix_role AS r ON ra.roleid = r.id
INNER JOIN prefix_user AS usr ON ra.userid = usr.id
INNER JOIN prefix_groups AS groups ON c.id = groups.courseid
INNER JOIN prefix_groups_members AS members ON groups.id = members.groupid
WHERE members.userid = usr.id
AND r.id = '5'
AND c.category = 62

ORDER BY groups.name
Average of ratings: Useful (1)