• Note that, unless you ABSOLUTELY need it for some reason, you should get rid of that final ORDER BY statement. It will only slow down your query and does not change the results.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001