Solved

sql server 2008: LEFT JOIN and FULL JOIN

Posted on 2011-03-16
2
738 Views
Last Modified: 2012-06-21
Hi experts

--3.2
SELECT p.Name, sod.SalesOrderID --238 rows
FROM Production.Product AS p
LEFT JOIN Sales.SalesOrderDetail AS sod
ON p.ProductID = sod.ProductID
WHERE p.ProductID IS NULL OR sod.ProductID IS NULL
ORDER BY p.Name ;

--3.3
-- The OUTER keyword following the FULL keyword is optional.
SELECT p.Name, sod.SalesOrderID --238 rows
FROM Production.Product AS p
FULL JOIN Sales.SalesOrderDetail AS sod
ON p.ProductID = sod.ProductID
WHERE p.ProductID IS NULL OR sod.ProductID IS NULL
ORDER BY p.Name ;

it is the same use left and full join?
 They have some example where you can see the difference?
0
Comment
Question by:enrique_aeo
2 Comments
 
LVL 19

Assisted Solution

by:Bhavesh Shah
Bhavesh Shah earned 250 total points
ID: 35153767
Hi,

No its not same.

check out this basic link.

http://en.wikipedia.org/wiki/Join_(SQL)

it will help you to know the difference with examples.


- Bhavesh
0
 
LVL 9

Accepted Solution

by:
kaminda earned 250 total points
ID: 35153935
In the left outer join you get (left join) values matching both tables on the given columns as well as the values exsists in the Left side of the join table with nulls for the right side table values.

In the Full Outer Join you get values matching both tables on the given columns as well as all the unmatching rows from both tables with nulls for the unmatching values.

In your case your getting same results because of the data you have.

This link has a perfect explaination on all outer joins http://www.quackit.com/sql/tutorial/sql_outer_join.cfm
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question