sql,tree

用sql语句从数据库中读取树形结构,仅适用于有两级的目录,select * from tablename order by case when  parentid=0 then id*10000 else parentid*10000+id end;

其中parentid是父id,详细地址:http://www.cnblogs.com/haozhenjie819/p/3901416.html

posted @ 2015-01-21 14:53  小胖是猪  阅读(158)  评论(0)    收藏  举报