<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Left Outer and Right Outer Join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-and-right-outer-join/m-p/1701213#M307401</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Can any one tell me the difference between a Left Outer and a Right Outer Join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Neo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Nov 2006 04:51:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-02T04:51:56Z</dc:date>
    <item>
      <title>Left Outer and Right Outer Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-and-right-outer-join/m-p/1701213#M307401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Can any one tell me the difference between a Left Outer and a Right Outer Join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Neo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 04:51:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-and-right-outer-join/m-p/1701213#M307401</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T04:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Left Outer and Right Outer Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-and-right-outer-join/m-p/1701214#M307402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The left outer join, on the other hand, reads lines from the left-hand database table or join even if there is no corresponding line in the right-hand table. &lt;/P&gt;&lt;P&gt;SELECT ... &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;FROM &amp;lt;tab&amp;gt; LEFT [OUTER] JOIN &amp;lt;dbtab&amp;gt; [AS &amp;lt;alias&amp;gt;] ON &amp;lt;cond&amp;gt; &amp;lt;options&amp;gt; &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;tab&amp;gt; and &amp;lt;dbtab&amp;gt; are subject to the same rules and conditions as in an inner join. The OUTER addition is optional. The tables are linked in the same way as the inner join with the one exception that all lines selected from &amp;lt;tab&amp;gt; are included in the final selection. If &amp;lt;dbtab&amp;gt; does not contain any lines that meet the condition &amp;lt;cond&amp;gt;, the system includes a single line in the selection whose columns from &amp;lt;dbtab&amp;gt; are filled with null values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the left outer join, more restrictions apply to the condition &amp;lt;cond&amp;gt; than in the inner join. In addition to the above restrictions: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EQ or = is the only permitted relational operator. &lt;/P&gt;&lt;P&gt;There must be at least one comparison between columns from &amp;lt;tab&amp;gt; and &amp;lt;dbtab&amp;gt;. &lt;/P&gt;&lt;P&gt;The WHERE clause may not contain any comparisons with columns from &amp;lt;dbtab&amp;gt;. All comparisons using columns from &amp;lt;dbtab&amp;gt; must appear in the condition &amp;lt;cond&amp;gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;For details and examples of outer join please have a look at below links.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://database.ittoolbox.com/documents/popular-q-and-a/inner-and-outer-join-sql-statements-2108&amp;lt;/b&amp;gt;" target="test_blank"&gt;http://database.ittoolbox.com/documents/popular-q-and-a/inner-and-outer-join-sql-statements-2108&amp;lt;/b&amp;gt;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 04:59:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-and-right-outer-join/m-p/1701214#M307402</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T04:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Left Outer and Right Outer Join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-and-right-outer-join/m-p/1701215#M307403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;LEFT OUTER JOIN&amp;lt;/b&amp;gt; is one of the JOIN operations that allow you to specify a join clause. It preserves the unmatched rows from the first (left) table, joining them with a NULL row in the shape of the second (right) table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scope of expressions in either the ON clause includes the current tables and any tables in query blocks outer to the current SELECT. The ON clause can reference tables not being joined and does not have to reference either of the tables being joined (though typically it does).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Example:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;--match cities to countries&lt;/P&gt;&lt;P&gt;SELECT CITIES.COUNTRY, REGION &lt;/P&gt;&lt;P&gt;FROM Countries &lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN Cities&lt;/P&gt;&lt;P&gt;ON CITY_ID=CITY_ID&lt;/P&gt;&lt;P&gt;WHERE REGION = 'Asia';&lt;/P&gt;&lt;P&gt;-- use the synonymous syntax, RIGHT JOIN, to achieve exactly &lt;/P&gt;&lt;P&gt;-- the same results as in the example above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT COUNTRIES.COUNTRY, REGION &lt;/P&gt;&lt;P&gt;FROM Countries &lt;/P&gt;&lt;P&gt;LEFT JOIN Cities&lt;/P&gt;&lt;P&gt;ON CITY_ID=CITY_ID;&lt;/P&gt;&lt;P&gt;-- Join the EMPLOYEE and DEPARTMENT tables, &lt;/P&gt;&lt;P&gt;-- select the employee number (EMPNO), &lt;/P&gt;&lt;P&gt;-- employee surname (LASTNAME), &lt;/P&gt;&lt;P&gt;-- department number (WORKDEPT in the EMPLOYEE table&lt;/P&gt;&lt;P&gt;-- and DEPTNO in the DEPARTMENT table) &lt;/P&gt;&lt;P&gt;-- and department name (DEPTNAME) &lt;/P&gt;&lt;P&gt;-- of all employees who were born (BIRTHDATE) earlier than 1930&lt;/P&gt;&lt;P&gt;SELECT EMPNO, LASTNAME, WORKDEPT, DEPTNAME &lt;/P&gt;&lt;P&gt;   FROM SAMP.EMPLOYEE LEFT OUTER JOIN SAMP.DEPARTMENT &lt;/P&gt;&lt;P&gt;   ON WORKDEPT = DEPTNO &lt;/P&gt;&lt;P&gt;   AND YEAR(BIRTHDATE) &amp;lt; 1930;&lt;/P&gt;&lt;P&gt;-- List every department with the employee number and &lt;/P&gt;&lt;P&gt;-- last name of the manager,&lt;/P&gt;&lt;P&gt;-- including departments without a manager&lt;/P&gt;&lt;P&gt;SELECT DEPTNO, DEPTNAME, EMPNO, LASTNAME&lt;/P&gt;&lt;P&gt;      FROM DEPARTMENT LEFT OUTER JOIN EMPLOYEE&lt;/P&gt;&lt;P&gt;	    ON MGRNO = EMPNO;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at below link.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;RIGHT OUTER JOIN&amp;lt;/b&amp;gt; is one of the JOIN operations that allow you to specify a JOIN clause. It preserves the unmatched rows from the second (right) table, joining them with a NULL in the shape of the first (left) table. A LEFT OUTER JOIN B is equivalent to B RIGHT OUTER JOIN A, with the columns in a different order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scope of expressions in the ON clause includes the current tables and any tables in query blocks outer to the current SELECT. The ON clause can reference tables not being joined and does not have to reference either of the tables being joined (though typically it does).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Example:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;-- get all countries and corresponding cities, including&lt;/P&gt;&lt;P&gt;-- countries without any cities&lt;/P&gt;&lt;P&gt;SELECT CITY_NAME, CITIES.COUNTRY&lt;/P&gt;&lt;P&gt;FROM CITIES RIGHT OUTER JOIN COUNTRIES&lt;/P&gt;&lt;P&gt;ON CITIES.COUNTRY_ISO_CODE = COUNTRIES.COUNTRY_ISO_CODE;&lt;/P&gt;&lt;P&gt;-- get all countries in Africa and corresponding cities, including&lt;/P&gt;&lt;P&gt;-- countries without any cities&lt;/P&gt;&lt;P&gt;SELECT CITY_NAME, CITIES.COUNTRY&lt;/P&gt;&lt;P&gt;FROM CITIES RIGHT OUTER JOIN COUNTRIES&lt;/P&gt;&lt;P&gt;ON CITIES.COUNTRY_ISO_CODE = COUNTRIES.COUNTRY_ISO_CODE;&lt;/P&gt;&lt;P&gt;WHERE Countries.region = 'frica';&lt;/P&gt;&lt;P&gt;-- use the synonymous syntax, RIGHT JOIN, to achieve exactly&lt;/P&gt;&lt;P&gt;-- the same results as in the example above&lt;/P&gt;&lt;P&gt;SELECT CITY_NAME, CITIES.COUNTRY&lt;/P&gt;&lt;P&gt;FROM CITIES RIGHT JOIN COUNTRIES&lt;/P&gt;&lt;P&gt;ON CITIES.COUNTRY_ISO_CODE = COUNTRIES.COUNTRY_ISO_CODE&lt;/P&gt;&lt;P&gt;WHERE Countries.region = 'Africa';&lt;/P&gt;&lt;P&gt;-- a TableExpression can be a joinOperation. Therefore&lt;/P&gt;&lt;P&gt;-- you can have multiple join operations in a FROM clause&lt;/P&gt;&lt;P&gt;-- List every employee number and last name &lt;/P&gt;&lt;P&gt;-- with the employee number and last name of their manager&lt;/P&gt;&lt;P&gt;SELECT E.EMPNO, E.LASTNAME, M.EMPNO, M.LASTNAME	&lt;/P&gt;&lt;P&gt;	FROM EMPLOYEE E RIGHT OUTER JOIN	&lt;/P&gt;&lt;P&gt;	DEPARTMENT RIGHT OUTER JOIN EMPLOYEE M &lt;/P&gt;&lt;P&gt;        ON MGRNO = M.EMPNO&lt;/P&gt;&lt;P&gt;        ON E.WORKDEPT = DEPTNO;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also have a look at below link.&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Nov 2006 05:07:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-and-right-outer-join/m-p/1701215#M307403</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-02T05:07:10Z</dc:date>
    </item>
  </channel>
</rss>

