How in 1 request to get all branch with childs?

Hello,
Having table with fields id, parent_id, title (mysql5) how can I with 1 request to get all branch with childs
of parent N ? I mean grandchilds and deeper too…

Thanks!

Relational databases are not designed for recursive problems but at the end it is of course possible.

Here is a very good explanation of the possibilities and pro and contra of them:

1 Like

that is pretty good

it’s too bad @mstdmstd is on MySQL 5, because of course the best solution uses the recursive CTE

here’s my article on one of the other methods, using self-joins – Categories and Subcategories

regarding depth of the tree, i’d like to draw attention to these three points –

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.