SQL Server 2005递归查询

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

  

posted @ 2014-05-27 15:49  star丶清影  阅读(163)  评论(0编辑  收藏  举报