如何列出所有上线

如何列出所有上线

This question already has answers here:
What is the most efficient/elegant way to parse a flat table into a tree?
                                
                                    (14个回答)
                                
                        
                                上个月关闭。
            
                    
php - 如何列出所有上线?-LMLPHP

我想选择“ Apple”,然后输出“ John”和“ Michelle”。
我尝试运行代码,但无法正常工作。请帮忙。

select @start := title as 'title', id, parent
from mytable
join
(select @start := 0) temp
where parent = @start and title = "Apple";


链接:http://sqlfiddle.com/#!9/91fd40/1/0

最佳答案

在您的sqlfiddle中运行此命令

select id, title, parent
from mytable
where id <= 4
ORDER BY title ASC;


演示

DEMO

关于php - 如何列出所有上线? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59551642/

10-12 17:38