L
L
lordprotein2020-02-29 12:44:11
MySQL
lordprotein, 2020-02-29 12:44:11

How to display all submenus of the main menu?

How can a query be made to display all submenus of the main menu (all descendants-children-children, etc.)?

5e5a3119d1aae916537404.png

5e5a31abe362c780958425.png

submenu refers to the parent ID (i.e. if there is a submenu, then this line is considered a child in relation to the menu specified in the submenu)

PS I tried the options from this answer , but they display only the main descendants, and there are no more descendants.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-02-29
@Rsa97

For your variant (Adjacency List) in one request in any way. You need to recursively execute queries on each individual submenu.
In one request, you can get all the children in the Nested Set or Materialized Path.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question