How to create a MySQL hierarchical recursive query?

For MySQL 8+: use the recursive with syntax.For MySQL 5.x: use inline variables, path IDs, or self-joins. MySQL 8+ The value specified in parent_id = 19 should be set to the id of the parent you want to select all the descendants of. MySQL 5.x For MySQL versions that do not support Common Table Expressions (up to version 5.7), you would achieve this with the … Read more