摘要: 如题,一个无限极分类的表,通过一个父类id,如何获取此父类下所有的子类??数据表:id,intclassname,varcharpartid,int如果在sql sever 2005或以上版本可以这样with a as(select id,classname,partid from NewClass where id=204union allselect x.id,x.classname,x.partid from NewClass x,a where x.partid=a.id)select * from a查询结果为: 阅读全文
posted @ 2012-05-17 15:44 ElaineHappy 阅读(1137) 评论(0) 推荐(0) 编辑