I created a table with name "net" and inserted values just like this.
id name parent
--------------------------------------
1 fruits 0
2 Apple 1
3 Orange 1
4 Grape 2
5 Green Apple 2
6 Red Apple 4
I want to get all parents of the child "6 ". please help me
The result i was expecting,when filtering the data ,where id=6,it will generate the result i'm expecting.
lv1 lv2 lv3
--------------------------------------
4 2 1
or like this
id name parent
--------------------------------------
4 Grape 2
2 Apple 1
1 fruits 0