Wednesday, January 28, 2015

Union of multiple CTE'S

Since you can't write all 4 concurrently then try to union directly to your queries as below,



Select a, b, c
From
(
[Query From cte1] join [Query From cte2)
)

Union

Select x, y, z
From
(
[Query From cte3] join [Query From cte4)
)

No comments:

Post a Comment