在MySQL中的父子模型中计算深度 [英] Calculate depth in a parent-child model in MySQL
本文介绍了在MySQL中的父子模型中计算深度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在MySQL下的父子模型中计算节点的深度?
How do I calculate a node's depth in a parent-child model under MySQL?
除其他事项外,我需要深度在列表中创建缩进(用PHP编码).
I'll need the depth to, among other things, create the indent in my list (coded with PHP).
推荐答案
这可能是个老问题,但我只是想让其他人知道我几个月前找到了解决方案.我最近确实在这里写过: http://en. someotherdeveloper.com/articles/adjacency-list-model-with-depth-calculation/
This might be an old question, but I just want to let others know that I found a solution some months ago. I did recently write about it here: http://en.someotherdeveloper.com/articles/adjacency-list-model-with-depth-calculation/
这篇关于在MySQL中的父子模型中计算深度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文