数据库设计: 字段 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);