Is there a way using only MySQL query to select ID=? and its related children and grandchildren and so on... until there are no more.
Example:
ID 1: Has is the parent, ID 2: Is the child of the parent, IDs 3-8: Are the grandchildren
I want to get results such as:
if ID=1, select 1,2,3,4,5,6,7,8
OR ID=2, select 2,3,4,5,6,7,8
OR ID=3, select 3
Something like:
select from TABLE where id=? while related>0 select from TABLE where related=? end while