Created
October 13, 2020 19:00
-
-
Save charlesroper/a874652dcc142ea50634050e7a22d90f to your computer and use it in GitHub Desktop.
All non-FSC users not enrolled on any courses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT | |
u.id, | |
u.username, | |
u.firstname, | |
u.lastname, | |
u.email | |
FROM | |
mdl_user u | |
LEFT JOIN mdl_user_enrolments e ON u.id = e.userid | |
LEFT JOIN mdl_role_assignments a ON u.id = a.userid | |
WHERE | |
u.id NOT IN ( | |
SELECT | |
userid | |
FROM | |
mdl_user_enrolments | |
) | |
AND u.id NOT IN ( | |
SELECT | |
userid | |
FROM | |
mdl_role_assignments | |
WHERE | |
roleid != 11 | |
) | |
AND u.deleted = 0 | |
ORDER BY | |
u.id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment