Performing query using Left Outer Join in SQL Server
Hi. How to perform a query through the use of Left Outer Join in SQL Server.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Dec 19, 2011, 12:31 AM
here is way..........
select t1.*,t2.* from table1 t1 (nolock)
left outer join table2 t2 (nolock) on t1.ID=t2.ID
so above query will return All matching records + nonmatching record of table1.
suppose table1 is like ...
ID empName Designation
1 Pravin S/W Dev.
2 Monika S/W Dev.
3 XYZ S/W Dev.
and table2 is like.....
ID Salary
1 20000
2 25000
so in this case result of above query will be
ID empName Designation ID Salary
1 Pravin S/W Dev. 1 20000
2 Monika S/W Dev. 2 25000
3 XYZ S/W Dev. null null
Thanks,
Pravin.