• Typically you only add additional parens to make the logic correct. Don't know there is a best practice here. I work to solve the problem - write a query that returns the data correctly - then look to see if performance is adequate. The ugly part of query tuning is you cant really optimize bits and pieces, you have to do it holistically. In other words, you have to make a change and see what the query planner does with it.

    A temp table might still work, did you index it to match what you have on the real table? A different way to approach the same thing is to replact the appt table with a subquery that does the initial limiting.

    After that, do you have every join column indexed on both sides?

    If you post the text of the query plan, we can look to see if something seems bad, such as a table scan.

    Andy

    http://qa.sqlservercentral.com/columnists/awarren/