with t as
(
with tt as
(
select * from table
)
SELECT * FROM tt
)
select * from t
我愿意对内部条款&的输出执行一些逻辑。而不是再次对外部with子句的输出进行一些操作。
任何帮助将不胜感激...
感谢
注意: - 它只是一些简化的查询,它将在我的实际查询中解决我的问题,它嵌套了子句
答案 0 :(得分:19)
您可以这样做:
with t as
(
select * from table
),
tt as
(
select * from t
)
select * from tt
答案 1 :(得分:5)
不,你不能嵌套 CTE(公用表表达式),但你可以链接它们:
with t as
(
select * from table
),
tt as
(
select * from t
)
SELECT * FROM tt