If I have several temp tables, and I want to insert data into one of them but then continue to create more temp tables is there a way to do that or do I need to break my query up.
This is an example of what I'd like to do
WITH A AS (SELECT Column1, Column2, Column3 FROM SomeTable WHERE SomeConditionA), -- Inital Temp Table
B AS(SELECT Column1, Column2, Column3 FROM SomeTable WHERE SomeConditionB), --Second Temp Table
INSERT INTO A SELECT * FROM B --Insert Table B into Table A
C AS(...), --Derives From A
D AS(...), --Derives From C
E AS(...) --Derives From D
SELECT * FROM E --Final Select Statement
Essentially my issue is that I don't know how to write the insert in a way that will allow me to continue creating more temp tables afterwards.
Thanks!