Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL 2K is Left Join same as Left Outer Join?

Status
Not open for further replies.

ajacode

Technical User
Aug 21, 2002
66
US
In the SQL Server TSQL does LEFT JOIN return the same records as LEFT OUTER JOIN ?

If not what is the difference ?

Thanks,

AJ
 
Somebody correct me if I'm wrong, I believe that they are the same.

RIGHT JOIN IS the ANSI method which Microsoft is not going to support after SQL 2K

RIGHT OUTER JOIN is the new method which you should be using.
 
AJ,

Books online explaisn as follows:
LEFT JOIN or LEFT OUTER JOIN
The result set of a left outer join includes all the rows from the left table specified in the LEFT OUTER clause, not just the ones in which the joined columns match. When a row in the left table has no matching rows in the right table, the associated result set row contains null values for all select list columns coming from the right table.

Summary:
LEFT OUTER JOIN - brings all records from the left table
LEFT JOIN - Brings only the records that match from the left.

Hope this helps.
 
I'm going to disagree with that interpretation.

The RIGHT JOIN and the similar LEFT JOIN operations can be used in any FROM clause to combine records from two tables. The LEFT JOIN operation is used to create a left outer join and includes all of the records from the first (left) of the two tables, even if there are no matching values for records in the second. The RIGHT JOIN operation is used to create a right outer join and includes all of the records from the second (right) of the two tables, even if there are no matching values for records in the first.

 
I just tried LEFT JOIN and LEFT OUTER JOIN on a query involving two tables that have a common field upon which I made the join. The LEFT table had two records that had no match in the other table. When I ran LEFT OUTER JOIN and when I ran LEFT JOIN I got 1243 records both ways.
If I want just the matching records I use and INNER JOIN.

 
Thank You for each of your responses.

Yes Inner Joins are ONLY = records, and Indeed you have convinced me Left Join and Left Outer Join are the same syntax.

Thanks Again.

AJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top