I am trying to figure out if it is possible to do the following:
I am writing a message forum, and permissions in the forum are stored in a table 1 permission per column:
Users are associated to groups (well, the group name table [not shown] actually), and groups can be associated to multiple forums.
CREATE TABLE scc_bb_groups
(group_id NUMBER(*,0) NOT NULL,
forum_id NUMBER(*,0) NOT NULL,
PRIMARY KEY (group_id,forum_id));
Suppose a forum has two mod groups associated to it, and a given user is in both groups...
How could I collect both rows and OR them together (or however many rows there are)?
I can do this in PHP (and already have), but it would be nice to just pass in an id for a user and get all the groups they are in for a given forum and get s single row back per forum.
To clarify (with a simpler table than above):
Based on the above, the results I would like back from the query are (I will need to use an IN OUT REF CURSOR to get the results back to PHP):
grp_id forum_id view edit reply post
1 2 1 1 0 1
2 2 0 1 1 0
2 4 0 0 0 0
6 5 1 0 0 1
7 5 0 0 1 0
Would anyone be able to suggest how to write this in PL/SQL (if it can be?)
forum_id view edit reply post
2 1 1 1 1
4 0 0 0 0
5 1 0 1 1
Thanks in advance for any help!