WITH y AS ( WITH x AS ( SELECT * FROM MyTable ) SELECT * FROM x ) SELECT * FROM y
这样的事情有用吗?我早些时候尝试过,但我无法让它工作。
虽然不是严格嵌套,但您可以使用公用表表达式在后续查询中重用以前的查询。
为此,您要查找的语句形式为
WITH x AS ( SELECT * FROM MyTable ), y AS ( SELECT * FROM x ) SELECT * FROM y