Is there any difference, in terms of performance or any other pertinent
factor, between:
SELECT * FROM tblCustomers INNER JOIN tblCustomerOrders ON
tblCustomers.fldCustomerID = tblCustomerOrders.fldCustomerID
and
SELECT * FROM tblCustomers, tblCustomerOrders WHERE
tblCustomers.fldCustomerID = tblCustomerOrders.fldCustomerID
I note that if I type the latter into the SQL pane in a Data window,
SQL Server replaces it with the former.
TIA
Edward
--
The reading group's reading group:
http://www.bookgroup.org.ukShould give the same query plan.
Nigel Rivett
www.nigelrivett.net
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||If you examine the execution plans in Query Analyzer you will find the two
statements are identical. For INNER JOINs either syntax is legal and which
you use really comes down to readability and personal preference.
> I note that if I type the latter into the SQL pane in a Data window,
> SQL Server replaces it with the former.
One reason to avoid GUI query tools is that they tend to mess with the
formatting and syntax of your code. My advice is to use a proper query
editor, like Query Analyzer. In the long run you'll find you can write
better code much quicker that way.
--
David Portas
SQL Server MVP
--|||David Portas wrote:
> If you examine the execution plans in Query Analyzer you will find
the two
> statements are identical. For INNER JOINs either syntax is legal and
which
> you use really comes down to readability and personal preference.
> > I note that if I type the latter into the SQL pane in a Data
window,
> > SQL Server replaces it with the former.
> One reason to avoid GUI query tools is that they tend to mess with
the
> formatting and syntax of your code. My advice is to use a proper
query
> editor, like Query Analyzer. In the long run you'll find you can
write
> better code much quicker that way.
Thanks to you and Nigel. I agree with your distress at the way the GUI
tool in SQL Server messes with code - I like to have things laid out
just so, and it's no business of SQL Server to do it's nanny thing.
But that's Microsoft for you, the company that brought us Office
Assistant.
Unfortunately, for very involved outer joins with multiple tables, I'm
just not expert enough to craft the thing in QA, or rather I like to
see a graphical representation of the table relations. But I suppose I
could write it in QA, then paste it into a Data pane and see what the
GUI made of it.
Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk
--
We are what we repeatedly do. Excellence, then, is not an act, but a
habit - Aristotle
Those heights by great men reached and kept
Were not obtained by sudden flight,
But they, while their companions slept
Were toiling upward in the night
- Longfellow
No comments:
Post a Comment