Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL joins
Message
From
08/03/1999 16:42:45
 
 
To
08/03/1999 16:18:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00195078
Message ID:
00195348
Views:
17
Hi Brian,
In your example, table C is being joined to table A, not to the result of the first join.

I can't comment on differences in performance between the two examples. I think it is better to write SQL code by hand than to use output from the Query Designer. If you've benchmarked them and find the hand-coded version to be faster, then that's great.

I don't see any trap, although Steve Sawyer wrote about a gotcha, if I remember correctly.
One thing to keep in mind: when you say:
JOIN TableB ON TableA.AField = TableB.AnotherField

in order to enjoy the benefits of Rushmore, there must be an index on TableA.AField, that is, on the field on the left hand side of the = sign.

If you say:
JOIN TableB on TableB.AnotherField = TableA.AField

and there is an index on TableA.AField but not on TableB.AnotherField, the statement will work but it will be slow. If one field has an index and the other doesn't, always put the field with the index on the left of the = sign.
Also, if both fields have indices but one field has a faster index, put that field on the left. (For example, an index on an integer is always faster than an index on a character field.)

Regards, Chaim
Previous
Reply
Map
View

Click here to load this message in the networking platform