现有id,pid,name三个字段,要查找id为某值下面的所有数据,应该怎么写效率最高
走同样的路,发现不同的人生
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;
Oracle has a syntax that supports tree queries. For MySQL, you can only process it through code
Use php+mysql to implement through recursionPortal: http://blog.csdn.net/u0102656...
select a.*,b.name pname from table a,table b where a.pid=b.id and b.id=3
If the amount of data is not large, the program can recursively traverse the query spanning tree;
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...