I spent most of the day trying to figure out one simple outer join query in SQLServer 2005, it turns out that the problem stems from the WHERE clause, apparently SQL Server will execute the WHERE clause before the join? Which doesn't make much sense to me, it seems like a bug, but whatever, at least I only wasted about six hours trying to figure out that once you put the criteria within the join clause it works as expected.
Here are some more articles I found on the subject:
Outer Join trouble
Additional Criteria in the JOIN Clause
Friday, June 15, 2007
Subscribe to:
Posts (Atom)
