• Thank you. I now understand the basics of CTE's. I've seen them referenced and this article represents my first understanding. I'll reference it as I gain more knowledge.

    I can see using a CTE with UNIONS. I frequently write temp-code like this:

    Query1

    union

    Query2

    union

    Query3

    Where all three queries are similar but rather complex, but not so complex that I need a permanent view or even a temp table. With a CTE, I can maintain some readability and not have to worry about dropping the view/temp table afterward. 😉

    A fine article. Thanks again.