How do I nested common table expression?
To nest CTE just use comma:
;WITH cte1 AS (SELECT .... FROM [sometable])
,cte2 AS (SELECT .... FROM cte1 or/and [sometable] )
,cte3 AS (SELECT .... FROM cte2 or/and cte1 and [sometable] )
Or your question is really about recursive CTEs?
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
(So many miracle inventions provided by MS to us...)How to post your question to get the best and quick help