Greetings,
I like to write my inner joins as below,
but someone at work tells me its not as 'performant'
as using the 'inner join' statement.
Is this true ?
Is there a better way to write it ?
thanks
Mike
SELECT count(*)
FROM resources a, assignments b,
timesheets c, timesheetpayrollitems d
WHERE a.rsrchqnumber = 80002202
and a.rsrcguid = b.asgtrsrcguid
and b.asgtassignmentid = 0000006271
and b.asgtguid = c.tishasgtguid
and c.tishguid = d.tpittishguid
and d.tpitpayrollcode != 231
and d.tpitdaydate > '20050822' 4 2028
The two joins are identical, and there is no performance difference -
MSSQL will handle them in exactly the same way. The INNER JOIN / OUTER
JOIN syntax is generally preferred for several reasons: some outer
joins can't be written in 'old style' joins; separating join conditions
from filter conditions is often more readable; Microsoft has said it
may remove support for 'old style' joins in a future version of MSSQL.
If you Google for "sql 2000 ansi joins", you'll find many more detailed
discussions.
Simon
Simon Hayes (sq*@hayes.ch) writes: The two joins are identical, and there is no performance difference - MSSQL will handle them in exactly the same way. The INNER JOIN / OUTER JOIN syntax is generally preferred for several reasons: some outer joins can't be written in 'old style' joins; separating join conditions from filter conditions is often more readable; Microsoft has said it may remove support for 'old style' joins in a future version of MSSQL.
For old style *outer* joins that is.
The syntax that Mike used is part of the ANSI standard, and MS have
no plans to remove support for that syntax.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
Thanks - it's a good point to make that distinction.
Simon
Actually, thre is a good story about introducing infixed join
operators. We needed to define a workable OUTER JOIN syntax, to
replace the various proprietary syntaxes that were in actual products.
Once that was defined, INNER JOIN, NATURAL JOIN, OUTER UNION and a
bunch of other options were easy to define. So we did. Committees are
like that. Get a copy of the SQL-92 specs and take a look.
I prefer the "traditional" inner join because it shows me all the
search conditions in an easy to read format. It lets me see n-ary
relationships like BETWEEN's.
There is also a rumor that the ON clauses have to hold the join
conditions and the WHERE clause holds the SARGs (Search Arguments).
Not true, but it lets you see what part of a SELECT can be extracted
into a VIEW.
I have a whoel discussionof this in SQL PROGRAMMNG STYLE. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Prem |
last post by:
Hi,
I am having many problems with inner join. my first problem is :
1) I want to know the precedance while evaluating query with multiple
joins.
eg.
select Employees.FirstName,...
|
by: gkellymail |
last post by:
the following query works fine:
select link.idx, link.x_table, link.x_id_a, link.x_id_z, a.strandid,
b.strandid
from link_detail, link, strand A, strand B
where link_detail.x_table =...
|
by: dmonroe |
last post by:
hi group --
Im having a nested inner join problem with an Access SQl
statement/Query design. Im running the query from ASP and not usng the
access interface at all. Here's the tables:
...
|
by: MP |
last post by:
Hi
trying to begin to learn database using vb6, ado/adox, mdb format, sql
(not using access...just mdb format via ado)
i need to group the values of multiple fields
- get their possible...
|
by: Zeff |
last post by:
Hi all,
I have a relational database, where all info is kept in separate tables
and just the id's from those tables are stored in one central table
(tblMaster)...
I want to perform a query, so...
| |
by: Rick |
last post by:
VS 2005 & Firebird DB 1.5
I have a query for Customer orders that has several inner joins to show
things like Terms name (from termsnum) and Sales Rep name (from repnum) etc.
I have written...
|
by: Chamnap |
last post by:
Hello, everyone
I have one question about the standard join and inner join, which one
is faster and more reliable? Can you recommend me to use? Please,
explain me...
Thanks
Chamnap
|
by: stanlew |
last post by:
Happy New Year everyone! I'm new to both T-SQL and this forum. I'm currently doing an internship and my first task was to create a small program which will send an email detailing the sales of the...
|
by: shapper |
last post by:
Hello,
I am used to SQL but I am starting to use LINQ.
How can I create Left, Right and Inner joins in LINQ? How to
distinguish the different joins?
Here is a great SQL example:...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |