且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL 查询按父级然后子级排序

更新时间:2023-11-30 10:22:58

我认为你应该在你的表中多放一个字段,称为 level 并在其中存储节点的级别,然后按级别对查询进行排序,然后按父母.

I think you should put one more field in your table, called level and store in it the level of the node, and then sort your query by level then by parent.