Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL: where vs. join
Message
From
08/08/2009 11:27:30
 
 
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:
01416874
Views:
98
JOIN is the preferred method for specifying the join condition. WHERE is used to filter the data before it's joined. All the SQL gurus I know use JOIN

>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.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform