Hi All,
We using moodle 3.1.2 for our production. Within the file moodle/enrol/category/locallib.php there are a few queries stating .id IS NULL. Example below. Can someone explain the reason NULL is being used?
"SELECT DISTINCT ue.userid
FROM {user_enrolments} ue
LEFT JOIN {role_assignments} ra ON (ra.roleid $roleids AND ra.contextid $contextids AND ra.userid = ue.userid)
WHERE ue.enrolid = :instanceid AND ra.id IS NULL";
On our database, running the query select * from mdl_role_assignments where id = null; does not returning anything so a little confused why it is part of the code.
Another example is in forum https://moodle.org/mod/forum/discuss.php?d=153059 where someone shared a query to list all students not enrolled on a course stating where r.id =NULL
SELECT 'u'.'id', 'u'.'username', 'u'.'firstname', 'u'.'lastname', 'u'.'email' FROM 'mdl_user' 'u' LEFT JOIN 'mdl_role_assignments 'r' ON 'r'.'userid' = 'u'.'id' WHERE 'r'.'id' IS NULL AND 'u'.'deleted' = 0
Thanks
Ehsan