I have the following tables:
La tabla usuarios con el campo Id
La tabla rol con el campo Id_rol
La tabla enlace con el campo Id_user y Id_rol
En la tabla usuarios tengo insertado a "pedro"
En la tabla rol tengo insertado "admin","usuario","moderador"
En la tabla enlace tengo insertado "pedro","usuario"
I want to get the ROLES that do not belong to the user "pedro"
I tried using the following sql query but I can not get the proper result:
SELECT ID_ROL
FROM enlacerole,usuariodef1
WHERE enlacerole.ID_USER=usuariodef1.CORREO and CORREO='pedro@'
union
SELECT ID_ROL
FROM roledef1