• purushottam2 (3/7/2013)


    Which one is more performance oriented query?

    1. SELECT 1 FROM table1 WHERE Id IN (SELECT Id FROM table2)

    2. SELECT 1 FROM table1 t1 INNER JOIN table2 t2 ON t1.Id = t2.Id

    http://sqlinthewild.co.za/index.php/2010/01/12/in-vs-inner-join/[/url]

    “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