|
hello
i've got a table on my website which contains member and groupids along with a privilege on or off field. what i need to do is find all of the groups which a member belongs to and has privilege enabled in.
this is very easy to do, but what if a member could be a group? for example.
m1 is in g1, and g1 is a member of g2. because the memberid of g1 is not the member id of the currently logged in member, this query becomes rather difficult to fathom.
can this be acheived in mysql? i know that i could do something like this -
select m2.gid from members m1 left join members m2 on m1.gid=m2.uid where m1.uid=$myUserId
the problem with above is that it only works on 1 descedant, but my members could be 4th or 5th generation derived from the target group.
can anybody point me in the direction of some helpful documentation regarding this?
thank you
mark
|