Count all child nodes of hierarchical data in a table

前端 未结 3 1287
失恋的感觉
失恋的感觉 2020-12-06 14:02

I want to count number of all child nodes under any level of tree structure maintained in a table using adjacency model (parent-child key). Table structure and data looks l

3条回答
  •  醉梦人生
    2020-12-06 14:41

    The way you store your data will not allow for a simple query to get the total child count. But have a look at:

    http://en.wikipedia.org/wiki/Nested_set_model

    Where a query like this would be possible.

提交回复
热议问题