首页 > 代码库 > sql server根据一级分类查询所有子级分类

sql server根据一级分类查询所有子级分类

1 WITH a AS2  (3     SELECT * FROM dbo.db_UserGroup WHERE TB_UserGroupID=14     UNION ALL SELECT s.* FROM dbo.db_UserGroup AS s,a WHERE s.FK_ParentId=a.TB_UserGroupID5 )6 SELECT * FROM a

 

sql server根据一级分类查询所有子级分类