• T.Ashish (4/4/2013)


    Hi All,

    I have attached two queries with table definition and sample data.

    Query 2 is working better then query 1.

    Now the actual question is:

    Should I follow query 2 in big and very complex queries?

    Is there any other better way to handle this type of scenarios?

    Thanks.

    Where does the hardcoded value '0a1705011715553107773972' come from?

    “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