View Single Post
  #3  
Old February 28th, 2009, 07:45 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Better "Join" vs "Where" clause?

On Sat, 28 Feb 2009 13:00:08 -0500, wrote:

2003, 2007


At the EOD, it appears that a WHERE clause accomplishes the same data set as an [INNER] Join.

What are the benefits of one over the other?


A Query using a JOIN is much more likely to be updateable than one using a
WHERE, and I've heard that it can also be faster (since the query optimizer
makes better use of indexes).


Also, it does not appear that the use of [ or ] preceding / following Table names and/or Field
names changes data set results.


It certainly shouldn't!!!!

Is the use of [ or ] a convention for reviewing code or are there substantive issues in some
end-use cases?


The brackets are required if the fieldname contains blanks or other special
characters (which you should probably avoid doing in any case), or if you
(again, unwisely) use a reserved word such as Date or Group as a fieldname.
IME they are allowed anytime and never seem to do any harm; I'll generally
bracket the fieldnames just to make it obvious that they ARE fielnames,
especially if I'm building a SQL string in code.
--

John W. Vinson [MVP]