首页 > 代码库 > SQL Server 2005递归查询

SQL Server 2005递归查询

?
1
2
3
4
5
6
7
WHIT XXX(列1,列2....) AS (
    SELECT 列1,列2... FROM WHERE ID=xxxxxx
    UNION ALL
    SELECT 列1,列2.... FROM WHERE ID = XXX.ParentID
)
SELECT
    列1,列2.... FROM XXX