Hello, Folks
You may Have tried to Apply Union All betwenn two
CTEs.
For Example,
If you Have two Tables Named TableA and TableB
WITH CTE_TableA
AS
(
SELECT * FROM TableA
)
UNION ALL
WITH CTE_TableA
AS
(
SELECT * FROM TableA
)
Then Above SQL Statement Will be result into Error.
Now To Make Union Of Two CTEs, Follow Below Code Snippets,
WITH CTE_TableA
AS
(
SELECT * FROM TableA
),CTE_TableB
(
SELECT * FROM TableB
)
SELECT * FROM CTE_TableA
UNION ALL
SELECT * FROM CTE_TableB
Happy Coding !!!
He is a Smart IT devloper with Few years of Expeariance But having Great command on ASP.net,C#,SQL Query,SSRS,Crystal Reports
Apart from that He Loves multimedia work too, Master of Adobe photoshop, Illustrator, CSS , HTML and all things.
He is Currently working in Microsoft Dynamics CRM and Having Nice Expearince with CRM. CRM Rocks!!!