Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL: where vs. join
Message
 
 
To
08/08/2009 11:23:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01416873
Message ID:
01416913
Views:
68
There should not be difference in performance, IMHO, but I would always prefer JOIN syntax over WHERE syntax for better readability.

Also JOIN and WHERE behave differently, JOIN happens first, then WHERE.

>Is it more efficient to use JOIN instead of the older WHERE syntax - specifically for specifying the conditions to join two tables?
>
>In some tests I did with code I got from someone else, it took a long time to run, and at some moment, huge intermediate results were produced, to the point where Visual FoxPro complained that the temporary table grew too large. Changing the WHERE to a JOIN seemed to solve this, but so far, I haven't researched enough for the results to be conclusive.
>
>It should be noted that in this specific case, the WHERE conditions included join conditions, but also additional conditions, such as not empty(SomeField).
>
>If this is as I think it is, using the old-fashioned WHERE syntax could be labelled "plainly wrong", if it is used instead of the join condition. I had been using the JOIN for a while already, but for other reasons: (1) The syntax seems clearer to me (once the programmer gets used to the new syntax!), and (2) Easy to switch between inner and outer join.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform