MySQL recursive tree search

前端 未结 6 964
臣服心动
臣服心动 2020-12-17 07:06

I have a database with a tree of names that can go down a total of 9 levels deep and I need to be able to search down a signal branch of the tree from any point on the branc

6条回答
  •  忘掉有多难
    2020-12-17 07:21

    There isn't a nice/easy way of doing this; databases don't support tree-style data structures well.

    You will need to work on a level-by-level basis to prune results from child-to-parent, or create a view that gives all 9 generations from a given node, and match using an OR on the descendants.

提交回复
热议问题