Home Forums SQL Server 2008 T-SQL (SS2K8) Method to compare on resultset to part of another RE: Method to compare on resultset to part of another

  • Some pointers in the right direction - and kudos for asking for them instead of a solution. The type of problem you are investigating is called "Relational Division".

    The late Dwain Camps wrote an excellent article over on Simple Talk a couple of years back:

    https://www.simple-talk.com/sql/learn-sql-server/high-performance-relational-division-in-sql-server/[/url]

    Post back if you have issues - relational division can be tricky to conceptualise.

    “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