• rmechaber (4/28/2015)


    SQLRNNR (4/28/2015)


    Hey, so far it is improved in % correct. Only 53% got it correct when I asked a very similar question a few years back.

    http://www.sqlservercentral.com/questions/Subquery/75557/

    Well, I got today's right but yours from 2011 wrong. I am left with the conclusion that I must have learned something 3-1/2 years ago from you!

    (How's that for delayed "thanks I learned something" for ya?)

    As I said back in 2011 and is still true today: I never use the feature of CTEs aliasing column names in parentheses, b/c I find it more reliable to simply always code with one method of aliasing, in my SELECT list. That works regardless of query type.

    Is there in fact any benefit aliasing the columns in the CTE?

    Rich

    Occasionally it is necessary or beneficial. For the most part, I just alias in the select as you do.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events