我有这个 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;
有没有办法做到这一点?
感谢您的帮助