Saturday, January 25, 2014

Just a simple JOIN Scenario in SQL Server...

Create Table tblLeft
(
Col1 int,
Col2 int
)

Insert into tblLeft Values(1,1)
Insert into tblLeft Values(1,1)

Create Table tblRight
(
Col3 int,
Col4 int
)

Insert into tblRight Values(1,1)
Insert into tblRight Values(1,1)

Select * from tblLeft
Select * from tblRight

Select * from tblLeft inner join tblRight  on tblLeft.Col1 = tblRight.Col3

Select * from tblLeft left join tblRight on tblLeft.Col1 = tblRight.Col3

Select * from tblLeft right join tblRight on tblLeft.Col1 = tblRight.Col3









No comments:

Post a Comment