0
Hello, I would like suggestions on how to perform a query between two tables (Person and Person Permissions), where we have the table Person (person, name), the table Permissions(Permission_id, Description) and the table Permission_person(Personal permission_id, person, permission_id, permission_id).
Permissão = {{1,'Administrativo'},{2,'Usuário'},{3,'Colaborador'}}
Pessoa = {{1,'João'},{2,'Mario'},{3,'Maria'}}
Pessoa_Permissão = {{1,1,1},{2,1,3},{3,1,2},{4,2,2},{5,3,3}}
I need that when executing the query, be returned users who do not have the permission of collaborator (3).
Thanks in advance.
Updating
I need the query to return the person’s name and id (person, name). Below is the current status of my attempts.
select p.pessoa_id, p.nome
from pessoa p
join pessoa_permissão pes on pes.pessoa_id = p.pessoa_id
where pes.permissao_id <> 3;
at first you would only need to consult the Personal table_permission where the Permission Id is different from 3... but you needed to know what you expect to leave the query (you have to bring the name of the person and the permission description?) and if possible show us what you have already tried to do
– JMSlasher
Okay, I’ll edit the question. I appreciate your feedback.
– Carlos Henrique