title: Report using SqL
body: <p>Would like a report created out of 3 tables with the exact output</p>
  
  <p>Users table</p>
  
  <pre><code>User id  User name 
  1         user1
  2         user2
  3         user3  
  </code></pre>
  
  <p>USER_IN_ROLES table</p>
  
  <pre><code>USRINR_USER_ID   USRINR_ROLES_ID
  
  1                        103
  3                        104
  2                        105
  1                        107
  2                        108
  1                        105
  1                        108
  </code></pre>
  
  <p>roles rl</p>
  
  <pre><code>Roles ID                 Description
  104                      User management
  107                      Modify
  103                      Debit
  105                      General
  108                      Audit
  </code></pre>
  
  <p>Relation User id between table 1 &amp; 2 and roles id between 2 &amp; 3</p>
  
  <p>I would like a query that will give an op like this </p>
  
  <pre><code>UName   FirstEntitl     Second Entitl
  user1   Read only user  Debit
  user3   Security admin  User Management
  user2    Team           General
  user1   Read only user  Modify
  user2    Team           Audit
  user1   Read only user  General
  user1   Read only user  Audit
  </code></pre>
  
  <p>My attempt very basic </p>
  
  <pre><code> select usr.user_name, rl.role_code as firstentitl,
   Case
     When rl.role_code = 'UserManagement' then 'Sec Admin'
     When rl.role_code  = 'ManualModification' then 'BelgiumTax User'
     End as secondEntitileme
  from users usr, USER_IN_ROLES uir,  roles rl
  where usr.user_id=uir.usinr_user_id 
  and rl.role_id=uir.usinr_role_id;
  </code></pre>
  
  <p>So all users who have user managemnt as role( no other roles) will be Security admin A users who have modiy role will be team and if a user doesnt have modify and user managemnt is a read only user </p>