title: Moodle select script displays incorrect role for the user
body: <p>The role 'Bank Employee' is not assigned to employee WILLIAM DE DIOS as seen in the screenshot accessed from Moodle.</p>
  <p>But the script I made shows that this employee already has role of 'Bank Employee'.</p>
  <p>Here is the script:</p>
  <pre><code> select distinct u.username USER_NAME, u.firstname FIRST_NAME, u.lastname LAST_NAME, u. auth, 
   u.suspended, u. idnumber, u.email, u.maildisplay, r.name ROLE_NAME
   from mdl_user u
   left join mdl_role_assignments ra ON ra.userid=u.id
   left join mdl_role r ON ra.roleid = r.id
   where u.lastname like '%DE DIOS%' and u.firstname like '%WILLIAM%'
   order by lastname;
  </code></pre>
  <p>Help please I need to revise the script so that only the assigned role would appear.  'Bank Employee' role should not appear as seen in the Moodle module.</p>
  <p><a href="https://i.stack.imgur.com/F829L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F829L.png" alt="enter image description here" /></a></p>