WITH y AS ( WITH x AS ( SELECT * FROM MyTable ) SELECT * FROM x ) SELECT * FROM y
Does something like this work? I tried it ear
With does not work embedded, but it does work consecutive
;WITH A AS( ... ), B AS( ... ) SELECT * FROM A UNION ALL SELECT * FROM B
EDIT Fixed the syntax...
Also, have a look at the following example