我正在努力如何在MySQL中創建VIEW。 我有5個表:MySQL查看錶
- users - table with users data - groups - table with groups data - group_membership - relational table storing users memberships in groups - pages - table storing all pages data - permissions - relational table between pages and groups storing permissions to view page by group.
,我想創建應該告訴我哪些頁面是允許用戶根據他的小組成員看到的視圖。 例子:
User ID 1, is in groups 1, 2, 3 group 1 has permission for pages 1,2,3 group 2 has permission for pages 1,2,3,4 group 3 has permission for pages 1,2,3,4,5,6,7
如何創建視圖,將包含類似
user_ID | page_ID -------------------- 1 | 1 1 | 2 1 | 3 1 | 4 1 | 5 1 | 6 1 | 7
謝謝大家誰可以幫助數據。
你實際上不需要加入到用戶爲此,你可以把gm.user_id – 2013-04-24 00:41:24
作品完美。非常感謝 – 2013-04-28 00:58:14