When you run a query with joins, tables are joined first, and only then the WHERE conditions apply.
When you have a join at FROM and then a WHERE clause, the tables will be joined first, and only after then, the WHERE conditions will be applied.
Say you have
SELECt blah FROM tbl1 LEFT JOIN tbl2 ON blah
WHERE tbl1.somefield = 'sometext'
Firstly tbl1 and tbl2 will be joined. Then the condition will apply.
This does not only cause you to use up unnecessary amounts of memory especially for large tables, but it also alters the results. This may make a huge difference, note it :)
Note: This is proven for at least JetSql(Access) and MS SQL 2008.
No comments:
Post a Comment