K
K
kkoshakk2019-11-15 12:05:04
MySQL
kkoshakk, 2019-11-15 12:05:04

What query is needed in the MySQL database to select all children together with their parents with the Nested Sets structure?

Hello, I will have the following structure:
Regions of the country: 24 pcs. (parents);
Districts, cities of regional and district significance will come from each region, and settlements (villages, urban-type settlements) will come from them.
I want to make a selection from the database and sort in such a way that there would be an output like c. Raevka, Sinelnikovsky district, Dnepropetrovsk region.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2019-11-15
@Fragster

don't know what you use in laravel for nested sets but here is getting children with all parents sqlfiddle.com/#!9/4997d54/1

T
ThunderCat, 2019-11-15
@ThunderCat

For such a structure, separate tables for each entity are more suitable: region, district, settlement.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question