In the Article, Pivot Rolling Periods Without Using Dynamic T-SQL ( experts-exchange.com/viewArticle.jsp?aid=654 ), I explored the pivot of moving date based reports without the use of dynamic T-SQL, but still allow for re-use month after month without re-writing of code. Here is another introductory...
If you've looked up a Common Table Expressions in Books Online, you might have noticed that Microsoft says that you cannot have nested CTEs (meaning, you can't define a CTE in the definition of another CTE. Although this is technically true, you can still accomplish the same functionality in...