mysql怎么查询树形结构的数据
怪我咯
怪我咯 2017-04-17 16:25:15
0
4
595

现有id,pid,name三个字段,要查找id为某值下面的所有数据,应该怎么写效率最高

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(4)
PHPzhong

select a.*,b.name pname from table a,table b where a.pid=b.id and b.id=3

刘奇
SELECT fileds FROM table_name WHERE pid=id; 

If the amount of data is not large, the program can recursively traverse the query spanning tree;

Ty80

Oracle has a syntax that supports tree queries. For MySQL, you can only process it through code

左手右手慢动作

Use php+mysql to implement through recursion
Portal:
http://blog.csdn.net/u0102656...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!