0
我有下面的格式返回行的查询:构建动态分层结构
ID NAME PARENTID
1 Top level. 0
7 Second level1. 1
10 Third Level under Second Level1. 7
22 Second Level2. 1
23 Third Level1 under Second Level2. 22
24 Third level2 under Second Level2. 22
我想要做的就是动态地构建一个结构。上述数据需要按照以下层次结构进行组织:
Top Level.
Second Level1.
Third Level under Second Level1.
Second Level2.
Third Level under Second Level2.
Third Level under Second Level2.
数据可能是任何东西,对层次结构的深度没有限制。我正在寻找一种编程方式将这些数据组织到一个结构中,而不管查询返回的是什么。我在ColdFusion中写这个,所以如果你有CF的例子,那将是很好的,但伪代码会很好。谢谢您的帮助。