Código HTML:
| id_rol | nombre | y la tabla user_rol | rol | user | ------------------------ ------------------ |100 | user | | 100 | 100 |101 | manager | | 101 | 100 |102 | guest | | 102 | 100 |103 | admin | | 103 | 101 | 100 | 102 | 101 | 103
Código:
el resultado que espero es SELECT DISTINCT "r"."id_rol", "r"."nombre", "rp"."user" FROM "rol" AS "r" LEFT JOIN "user_rol" AS "rp" ON r.id_rol=rp.rol WHERE rp.user=101 r.estado='Activo' ORDER BY "rp"."persona" ASC
Código HTML:
100 user null 101 manager null 102 gest null 103 admin 101
Código HTML:
103 admin 101