Here's my sample table using this query :
select term_taxonomy_id
, parent
from wp_term_taxonomy
where term_taxonomy_id in (174,371,493,45,401);
371 is parent of 45 and 45 is parent of 401 (371->45->401).
I searched but couldn't find any real recursive solution whatever I tried could only get the child in one level for real.
I want to use something like this at first:
select term_taxonomy_id
, parent
from wp_term_taxonomy
where term_taxonomy_id in (174,371,493);
right now it gives :
I want to change it to support recursive selection of children, since it has 371 I want it to get its child 45 and append it and since 45 is parent of 401 I want also 401 to get appended.
174 and 493 are not parents so the result should be :