查询管理员级别访问权限
表格:
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)
所以我有查询:
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'
返回:
Id -> Module -> Cod_Permission -> Administator
1 gallery 1 user123
2 gallery 2 user123
我想将同一模块的所有结果分组在一行中,如下所示
Id -> Module -> Read -> Update -> Delete -> Insert -> Username
1 gallery 1 0 0 4 user123
如何做到这一点?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的东西 -
在不确切知道不同领域是什么的情况下,我不能 100% 确定,但这应该会让你朝着正确的方向前进。
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.
尼科尔斯,好家伙!
解决方案:
您的查询相同,仅更改:
for
nnichols nice dudeeee!
SOLUTION:
same query yours, only change:
for