1
I need to create a relational query that returns records containing data from both the PERMISSAO table and the USUARIOS table. ALL PERMISSIONS records must be displayed. When there are no USER records, NULL must be displayed. The PERM_USU is used to relate the USUARIOS and PERMISSAO tables (in multi-schema for multiple). There is a condition, where PERM_USU.USUARIO_ID = 34
permission
- id (int)
- permission (varchar)
users
- id (int)
- user (varchar)
perm_usu
- permission_id (int)
- user_id (int)
I tried the query below, but it returns only the records that exist in Table 1 and Table 3.
select PERMISSAO.*, USUARIOS.* from PERMISSAO
left join PERM_USU on PERMISSAO.ID = PERM_USU.PERMISSAO_ID
left join USUARIOS on USUARIOS.ID = PERM_USU.USUARIO_ID
where PERM_USU.USUARIO_ID = 34
Thanks in advance for the help
Tried to trade left Join for only Join?
– Rafael Withoeft
Well I tested here what I said above and it didn’t work...
– Rafael Withoeft
I tried to replace the left Join with several other types of Join and the result was the same
– Michel Curti
Which bank are you using?
– mateusalxd