hanglam1
asked on
Nested Inner Join Question ??
This is basically a question about how an inner joins works .
I have this query :
Select a1.Name, b2.Name, c3.Name, d4.Name
from a1
inner join b2
on a1.NameID = b2.NameID
inner join c3
on a1.NameID = c3.NameID
inner join d4
on a1.NameID = d4.NameID
and
Select a1.Name, b2.Name, c3.Name, d4.Name
from a1
inner join b2
on a1.NameID = b2.NameID
inner join c3
on b2.NameID = c3.NameID
inner join d4
on c3.NameID = d4.NameID
The differences are on the "ON Clause" . Would there be difference on results between these two queris ?
How does a inner nested query work ?
I always thought, the query will first resolve the first inner query and use that result to do the second inner query and so on.
Thanks,
Hang
I have this query :
Select a1.Name, b2.Name, c3.Name, d4.Name
from a1
inner join b2
on a1.NameID = b2.NameID
inner join c3
on a1.NameID = c3.NameID
inner join d4
on a1.NameID = d4.NameID
and
Select a1.Name, b2.Name, c3.Name, d4.Name
from a1
inner join b2
on a1.NameID = b2.NameID
inner join c3
on b2.NameID = c3.NameID
inner join d4
on c3.NameID = d4.NameID
The differences are on the "ON Clause" . Would there be difference on results between these two queris ?
How does a inner nested query work ?
I always thought, the query will first resolve the first inner query and use that result to do the second inner query and so on.
Thanks,
Hang
What is the database?
ASKER
ptjcb ,
The database is Microsoft SQL Server 2000
The database is Microsoft SQL Server 2000
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
@BigSchmuh ... thanks for the comment in my direction ... not to excuse myself for my statement ... and surely not for seeming offending! ... but, I keep with my opinion that an Inner Join used in a query is more efficient than an outer join ... -> depending on the target of the query ... of course!
Best regards,
Raisor
@BigSchmuh ... thanks for the comment in my direction ... not to excuse myself for my statement ... and surely not for seeming offending! ... but, I keep with my opinion that an Inner Join used in a query is more efficient than an outer join ... -> depending on the target of the query ... of course!
Best regards,
Raisor
ASKER
I just want it to confirm with the experts here that both inner joins return the same values. I tested the queries in MSSQL Query Analyze before and it did return the same values.
Thanks all,
Hang
Thanks all,
Hang