Suppose we have table with below information
id name level Parent_id
1 A 1 ---
2 B 1 ----
3 C 2 1
4 D 2 2
5 E 3 3
6 F 3 4
7 G 4 5
8 H 4 5
i want the result in this format.
id L1Name L2 Name L3 Name L4Name
1 A - - -
2 B - - -
3 A C - -
4 B D - -
5 A C E -
6 B D F -
7 A C E G
8 A C E H
i want this result in mysql. we can find this in oracle by using Connect by prior. How about in mysql.please help.
you may looking for this
DEMO HERE
EDIT :
try this
SQL DEMO HERE