我有这个CTE1,我想在2个或更多不相关的查询中引用它
WITH CTE1
AS
(
SELECT col1, col2, col3
FROM Table1
WHERE condition
)
SELECT * FROM CTE1;
SELECT * FROM CTE1 c // This is not working -- Invalid object name 'CTE1'.
JOIN TABLE2 t
ON c.colx = t.xolx;
有没有办法实现这个目标?
感谢您的帮助