Hello,
I'm trying to figure out a way that I can make a query select specific fields which are dependent on another parameter's results.
That sounds confusing, basically what I'm trying to do is avoid multiple queries for a group rights manage table.
The basic structure I'm working with is linking groups in a hierchy, so that parent groups can access their child groups hierchy,
So lets say we have these groups
A parent of - > [ B - C ]
B parent of [ D - F - G ]
C parent of [ E - F - I]
D parent of
so A could access pretty much everyone's, B could access D's, F's, G',s and their groups, such as D's I and H and so foruth
So basically I want to name a single group, and determine a groups right's to a 3rd degree, meaning
A - > C -> D - > I
0 - > 1 -> 2 - > 3
So A could not see I's groups.
now, I want to accomplish this is as little queries as possible, idealy one.
The groups are ordered in the DB as such
GROUP ID | GROUP LINK ID
A | B
A | C
A | D
B | E
B | G
B | I
C | G
C | F
G | V
G | X
i could do different queries, but that could get very numerous depending on how many groups are linked. so I wanted to determine the results of the whole query based on the return part of the same query.
Such as return A's group as 1d, 1d results group As 2D, 2D's results groups as 3D
is that possible in mysql, or how could I accomplish this?