Subject Re: what should i use where or join? whats the difference?
Author Louis Luangkesorn
--- In, Fabio Gomes <fabioxgn@g...>
> It can sound stupid, but i m newbie in this sql stuff.. i noticed that
> something like:
> WHERE X.field=Y.field
> is the same as:
> JOIN table X ON (X.field=Y.field)
> Whats the difference? Wich should i use and why? And what about
speed? wich
> one is faster?
> Sorry if it sound stupid, but i never studied SQL, nor Firebird, i
> all by myself, so i use what works, and both works, but i dont know
how and
> why it works.
> Thanx for any help.
> [Non-text portions of this message have been removed]
Also a non-expert, but I think I can come up with something
intelligent, learned the hard way.

If what you want to do is match two tables on an index field, the
where statement will suffice. However, if the two tables are not
symmetric, meaning that one table has entries that do not have a
corresponding record in the other table, the entrees in the first
table that do not have a corresponding record in the second will not
show up in the results at all. And of course, this occurs silently
(which programmers know is bad). The JOIN ... ON syntax has
variations of LEFT or RIGHT or FULL OUTER JOIN, where all entries in
one of the tables will appear in the result, and the fields from the
second table will be filled in where they exist. For data collection,
it is a good way to find out if your data collection efforts was

In case you are wondering, the hard way to learn this is to look
through the results for information on a record that mysteriously
disappeared . . . Now I do all such queries using JOIN ON, since if I
find I need an OUTER JOIN it is a bit easier to manage the change.
Can't tell you anything about speed or performance though.