Tables:
Admin
Id | User | Pass
Modules
Id | Name (ex. users, admin, gallery )
Permissions
Id | Name (ex. add, delete, read, update)
Levels
Id | Module (ex. gallery) | Cod_Permission (ex. 10) | Administrator (ex. user123)
So an I have query:
SELECT
n.Modulo,
p.Nome AS Tipo,
n.Administrador AS Nome,
n.Cod_Permissao
FROM
niveis AS n
Inner Join modulos AS m ON n.Modulo = m.Nome
Inner Join permissoes AS p ON n.Cod_Permissao = p.Codigo
WHERE
n.Administrador = 'user123'
Return:
Id -> Module -> Cod_Permission -> Administator
1 gallery 1 user123
2 gallery 2 user123
I want group all results for same module in one line like this
Id -> Module -> Read -> Update -> Delete -> Insert -> Username
1 gallery 1 0 0 4 user123
How to make this?
Something like this –
Without knowing exactly what the different fields are I cannot be 100% sure but this should get you heading in the right direction.