Any solution posed with a CTE can always be done without the CTE by making the CTE into a derived table as Lynn has shown.
That's not entirely true. It's only true if the CTE is not recursive. Recursive CTEs cannot simply be rewritten as derived tables.
Even where they can be rewritten as derived tables, I find the CTE syntax easier to understand, and would recommend using the CTE in any case.
J. Drew Allen
Business Intelligence Analyst
How to post data/code on a forum to get the best help.How to Post Performance Problems
Make sure that you include code in the appropriate IFCode tags, e.g. [code=sql]<your code here>[/code]. You can find the IFCode tags under the INSERT
options when you are writing a post.