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