General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only