WITH RecursiveCategories (ParentID,ID ,CateName ,Parenturl,Level)
AS
(
SELECT 系统__路径ID, 路径ID, 路径名称,url, 0 AS Level
FROM 系统_导航路径
WHERE 系统__路径ID = 0
UNION ALL
SELECT 系统_导航路径.系统__路径ID, 系统_导航路径.路径ID, 系统_导航路径.路径名称,
系统_导航路径.url, Level + 1
FROM 系统_导航路径
INNER JOIN RecursiveCategories AS d
ON 系统_导航路径.系统__路径ID = d.ID
)
Select * From RecursiveCategories Order By Level Asc
AS
(
SELECT 系统__路径ID, 路径ID, 路径名称,url, 0 AS Level
FROM 系统_导航路径
WHERE 系统__路径ID = 0
UNION ALL
SELECT 系统_导航路径.系统__路径ID, 系统_导航路径.路径ID, 系统_导航路径.路径名称,
系统_导航路径.url, Level + 1
FROM 系统_导航路径
INNER JOIN RecursiveCategories AS d
ON 系统_导航路径.系统__路径ID = d.ID
)
Select * From RecursiveCategories Order By Level Asc