• GSquared (7/30/2008)


    I just found something quite interesting on this question.

    I hadn't realized that BOL says, "EXCEPT returns any distinct values from the left query that are not also found on the right query." Note, "distinct". I hadn't noticed that before.

    Except will give you the non-overlaps between two queries (two tables, whatever), but it will only return one row for each distinct value.

    I found this by accident while performing some speed tests on left join vs except. Left join was returning over 8000 rows, while except was giving me 21, because of the way I generated the test data.

    This is very good to know...didn't realize that and can only imagine how frustrating tracking that down could be.

    Now, I don't have to - thanks. 😉

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs