Search code examples
mysql-5.6

get all children of a parent mysql one query for 5.6


Table only has column

|id|Name|Parent

the parent being the root of the of the table

The result required

|Parent|child_id|Ancestral_Level

Child_ids All the succeeding Children where the parent

is their a way to do it on 5.6 as simple as possible?

Update

Now i just need the depth level to perent


Solution

  • I think you may find the answer you are looking for here: Hierarchical data in MySQL: parents and children in one query