A
A
Anton Natarov2015-10-28 16:29:30
MySQL
Anton Natarov, 2015-10-28 16:29:30

How to write a recursion on children?

A simple example. There is such a hierarchy: region, city, regions.
The table looks like this:
Google Tab
I want to filter by State and Region. respectively in the table more than 50000 records. For a faster selection, I decided to assign all cities and regions to their regions.
code_level is the id of the hierarchy 1 - region, 2 - cities, 3 - regions, respectively.
1) I don’t know how to write a recursive function correctly to go to the very regions and visit the regions for cities and regions.
Working in Symfony2 + postgreSQL Just in case someone knows how to do this via Php.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2015-10-28
@HanDroid

"Objectively"
https://github.com/Atlantic18/DoctrineExtensions/b...
"Functionally"
PHP. How to form a dynamic multidimensional array?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question