我有三个表,Roles、Permissions 和 Role_Permissions
Table Roles has the following: id, role_name
Data: id, role_name
1, Accounting
2, Order_Entry
3, Shipping
Table Permission has: id, permission _name
Data: id, permission _name
1, Admin
2, Super_User
3, Read_Write
4, Read_Only
Table Role_ Permissions has:
role_id (FK from Roles),
permission_id (FK from Permissions)
我需要创建一个如下所示的矩阵:
Heading: Roles Admin Super_User Read_Write Read_Only
Columns/Rows: Accounting X X
Order_Entry X X
Shipping X X
“X”表示该角色有权限。当然,空白意味着该角色没有权限可以在SQL中完成吗