• Toby Harman - Thursday, March 14, 2019 12:03 AM

    Thanks Stuart
    So the subquery becomes (SELECT t1.c1 from t2) which makes even less sense to me!
    I appreciate that t1 is in scope and therefore can be parsed and used, and that MS have documented this behaviour, but I doubt many would find it desirable!

    Toby it might make more sense if you were doing something like this:
    (SELECT t1.c1 * t2.c1 FROM t2)

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden