我有一棵这样的树:
Country
|
State
____|____
/ \
City_1 City_2
______|______
/ \
Neighborhood_1 Neighborhood_2
在我的数据库中,我有以下记录:
| path |
|------------------------------------|
| Country |
| Country.State |
| Country.State.City1 |
| Country.State.City2 |
| Country.State.City1.Neighborhood_1 |
| Country.State.City1.Neighborhood_2 |
我想从路径中搜索,并获取计算该路径的任何节点的所有记录,不包括不在匹配分支中的记录,如下所示:
| path |
|------------------------------------|
| Country |
| Country.State |
| Country.State.City1 |
| Country.State.City1.Neighborhood_1 |