.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

explanation of the joins

Posted By: dotnetbubbles     Posted Date: June 23, 2010    Points:2   Category :Sql Server
Can anybody explain me the following query execution?

dbo.A.aid aid, dbo.A.aname anme,
B.bid bid,dbo.B.bname bname,
dbo.C.cid cid, dbo.C.cname cname,
dbo.D.did did, dbo.D.dname dname

dbo.A inner JOIN dbo.B on a.aid=dbo.b.bid
inner join dbo.c on dbo.c.cid= dbo.b.bid
inner join dbo.d on dbo.c.cid= dbo.d.did

how the inner/left/right outer joins works? bottom to top (or) top to bottom approach.

thanks in advance.

Author: Lakhan Pal Garg             
Posted Date: June 23, 2010     Points: 5   

Hi -
Joins works as bottom to top.

according to your query first it will picl the common record of table c and D and then from B and result of previous (C Inner JOIN D) and finally From A and Result of (B INNER JOIN C INNER JOIN D).

In Case of Left Outer Join it willn first Pick all the record from C Table and matching Records from D table and then All From Table B and matching record from (C LEFT OUTER JOIN D ) and so on.

In Case of RIGHT Outer Join Instead of pick all the records from left table it will pick all the records from right side table.

Lakhan Pal Garg

Author: Deco             
Posted Date: September 11, 2010     Points: 5   

It will work on Top to bottom approach

first it would compare a and b

then c with the result set of a and b...


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend