1 - Root - 20
2 - child1 - 3
4 - child2 - 5
6 - child3 - 7
8 - child4 - 9
This is a nested set model of mysql.
let's say that the _lft
and _rgt
are the fields which indicates the left and right values
as I see the lower the value is the lefter are the child? so here we got 2 childs from the left side, and 2 childs from the right side, can be this done without adding a new field like direction
which may indicate the child direction before inserting it?
I want to determine this only using _lft
and _rgt
, I can't figure out what is the logic, even in words, no code nessesary
How can I make a query only those childs who belongs to the left side relative to the parent?
any suggestions please, thanks.