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