Hi,
I need to build a query that display all the users and their roles for cerain course.
I tried this query:
But it take in account only roleid = 5.
SELECT
user2.firstname AS Firstname,
user2.lastname AS Lastname,
user2.email AS Email,
user2.city AS City,
course.fullname AS Course
,(SELECT shortname FROM mdl_role WHERE id=en.roleid) AS ROLE
,(SELECT name FROM mdl_role WHERE id=en.roleid) AS RoleName
FROM mdl_course AS course
JOIN mdl_enrol AS en ON en.courseid = course.id
JOIN mdl_user_enrolments AS ue ON ue.enrolid = en.id
JOIN mdl_user AS user2 ON ue.userid = user2.id
I need all roles, I tried playing also with table role_assigments but that gave me only special roles (like manager).
How can I get all the roles?
Thanks