无限分类设计

数据库设计: 字段 id 分类名称name   父ID  路劲path

 

如果想要查询电脑下所有的分类:

select id,name,path from catogory1 where path like (select concat(path,'-',id,'%')  from catogory1 where id=1);或者

select id,name,path from catogory1 where path like (select concat(path,'-',id,'%') as path from catogory1 where id=1);

 

posted @ 2018-09-17 14:48  龙卷风之殇  阅读(163)  评论(0编辑  收藏  举报