My objective is to use the same technique to select results from one CTE and insert them into another table using a different CTE. How do you do it?
Error:
invalid object name xy.
My query is:
WITH ds
(
Select a, b, c
from test1
),
xy
(
select d, e, f
from test2
where (uses conditions from ds)
)
Select *
from ds (the result set of ds, am exporting this to csv)
Insert into AuditTest
(
Select * from xy
)
Can someone please help me with this?