Hi
scenario is,
A user can be a member of one or more groups, or none.
unlimitted number of usergroups can be created (in my application im expecting hundreds if not thousands of groups)
there must be a way to query all users of a specific user group
the only way i can think of are:
USERGROUP MASTER TABLE w/ USERGROUP USERS TABLE
eg.
usergroup: admin, group_id = 1
usergroup_users: group_id = 1 / user_id = 1
usergroup_users: group_id = 1 / user_id = 2
usergroup_users: group_id = 1 / user_id = 3
so on...
the above is the easiest, but darn there's gona be a bunch of rows in that usergroup_users table .. specially if one is expecting 1000 users / group x 1000 groups .. lolz
the other way, w/c is harder is,
do away with the usergroup_users table, and just do this:
USER: user_id=1 / usergroup_ids = "1,2,3,4,5,";
i saw this being used in different applications, like popular forum software.. but this is gona be HELLISH to manage/update
adding a user to a group, once needs to process the usergroup_ids (split/explode etc) for each user x 1000 or more ...
hmm...
what's the best method? or is there other more "cool" way to do this?
tnx