Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    28

    Unanswered: Right/Left Outer join

    Can any one pls give me some example to explain Right/Left Outer join & where all it is used...

    Thanks
    Deb

  2. #2
    Join Date
    Jun 2003
    Posts
    140

    Re: Right/Left Outer join

    In a left join, the outer table and inner table are the left and right tables respectively. The outer table and inner table are also referred to as the row-preserving and null-supplying tables, respectively.

    In a right join, the outer table and inner table are the right and left tables respectively.

    For example, in the queries below, T1 is the outer table and T2 is the inner table:

    T1 left join T2
    T2 right join T1

    Or, using Transact-SQL syntax:

    T1 *= T2
    T2 =* T1

    for more info refer to chapter 4 of Sybase Transact-SQL User's Guide

  3. #3
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524

    Re: Right/Left Outer join

    Originally posted by perl

    T1 left join T2
    T2 right join T1

    Or, using Transact-SQL syntax:

    T1 *= T2
    T2 =* T1
    The both syntax are not the same, and the ANSI SQL 92 behavior is not the same in case of condition. E.g.

    Compare the both outputs of

    Code:
    SELECT P.NAME, L.NAME
    FROM PERSON P, LOCATION L
    WHERE P.CODE_LOCATION*=L.ID
    AND L.NAME = "LONDON"
    
    SELECT P.NAME, L.NAME
    FROM PERSON P LEFT OUTER JOIN LOCATION L
    ON  P.CODE_LOCATION=L.ID
    AND L.NAME = "LONDON"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •