Solved

sql server 2008: LEFT JOIN and FULL JOIN

Posted on 2011-03-16
2
739 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

732 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