T-SQL: multiple usage of CTE alias - not only in outer query
问题 I've got a question which occurs when I was using the WITH-clause in one of my script. The question is easy to pointed out I wanna use the CTE alias multiple times instead of only in outer query and there is crux. For instance: -- Define the CTE expression WITH cte_test (domain1, domain2, [...]) AS -- CTE query ( SELECT domain1, domain2, [...] FROM table ) -- Outer query SELECT * FROM cte_test -- Now I wanna use the CTE expression another time INSERT INTO sometable ([...]) SELECT [...] FROM