Suppose I have a realm table (id, parentId, name, path).
Given Id, I would like all the children (children of the children to be included, recursively) from this area.
I keep the path from parents to the child.
Example:
1 NULL New York /1/
2 1 BRONX /1/2/
3 1 MANH /1/3/
4 3 UpWest /1/3/4/
5 3 MidEast /1/3/5/
Therefore, when you ask what the children of New York are, the request should return the Bronx, Manh, in the West and the Middle East. and not only the Bronx and Manh.
source
share