查询列出分层数据中的所有路径
我已经创建了表并在其中存储了分层数据。该表与此答案完全相同。也有一些检索查询。
但我想列出表中所有可能的路径。查询内容是什么?
输出应该是 -
ROOT ROOT/Dir2 ROOT/Dir3 ROOT/Dir4 ROOT/Dir5 ROOT/Dir3/Dir6 ROOT/Dir5/Dir7
....(顺序无关紧要)
I have created the table and stored the hierarchical data in it. The table is exactly as given this answer. There are some queries for retrieval too.
But i want to list all possible paths from the tables. What is the query ?
The output should be -
ROOT ROOT/Dir2 ROOT/Dir3 ROOT/Dir4 ROOT/Dir5 ROOT/Dir3/Dir6 ROOT/Dir5/Dir7
.... (Order does not matter)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想通过重复向查询添加左连接来伪造无限的深度或高度。只有当您确切知道树的高度或给自己设定一个限制时,这才有效。
You want to fake an unlimited depth or height by repeatley adding left joins to your query. This can only work if you know exactly the height of your tree or you set yourself a limit.