I’ve read that table joins are usually more efficient over sub queries, is this true? Will SQL Server 2005 and/or 2008 convert the sub query to a table join if it thinks it would be better?(Considering it uses a declarative language rather than an imperative one).
Regardless of the size of the tables i’m working with, I would like to get in the habit of doing it the best way. That means that if most of the time SQL Server will probably convert my code to a Join, I will just save it from having to do the work.
Note: Sub queries seem to be less code to write, but I don’t think joins are any harder to visualize than writing a sub query.
It would probably be best to check the execution plan for individual cases. This will clue you in on its internal operation. Try the query a few different ways and analyze the execution plans.