473,240 Members | 1,450 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,240 software developers and data experts.

inner joins

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'

Sep 7 '05 #1
4 2007
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

Sep 7 '05 #2
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

Sep 8 '05 #3
Thanks - it's a good point to make that distinction.

Simon

Sep 9 '05 #4
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.

Sep 10 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
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,...
2
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 =...
6
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: ...
52
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...
3
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...
2
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...
12
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
0
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...
9
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:...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.