<?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 Re: LEFT OUTER JOIN and INNER JOIN in same select in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424909#M1244894</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following which will work fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select a&lt;SUB&gt;field from ztab1 as a left outer join ztab2 as b on a&lt;/SUB&gt;field = b~field&lt;/P&gt;&lt;P&gt;inner join ztab3 as c on b&lt;SUB&gt;field = c&lt;/SUB&gt;field into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Mar 2009 10:17:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-03-24T10:17:59Z</dc:date>
    <item>
      <title>LEFT OUTER JOIN and INNER JOIN in same select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424904#M1244889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have 3 tables with following key field values (column is kalled id):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ztab1: one, two, three, four&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ztab2: one, two, three&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ztab3::one, two&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to INNER JOIN table 2 and 3 and I want to LEFT OUTER JOIN table 1 and 2. So the result set I am expecting is values one, two, three, four.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my select that is not working but only returning one,two, three (four is missing).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT ztab1~id
FROM ztab1 LEFT OUTER JOIN ztab2
      ON ztab1~id = ztab2~id INNER JOIN ztab3
      ON ztab2~id = ztab3~id&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is this returning only one, two, three and not the four as well and how can I rewrite this select to that it works?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2009 09:28:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424904#M1244889</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-24T09:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: LEFT OUTER JOIN and INNER JOIN in same select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424905#M1244890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "ON" keyword compares the id -&amp;gt; FOUR from itab1 and it doesnt find any FOUR in itab 2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2009 09:30:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424905#M1244890</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-24T09:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: LEFT OUTER JOIN and INNER JOIN in same select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424906#M1244891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ztab1~id&lt;/P&gt;&lt;P&gt;FROM ztab2 INNER JOIN ztab3&lt;/P&gt;&lt;P&gt;      ON ztab2&lt;SUB&gt;id = ztab3&lt;/SUB&gt;id &lt;/P&gt;&lt;P&gt;LEFT OUTER JOIN ztab3&lt;/P&gt;&lt;P&gt;      ON ztab1&lt;SUB&gt;id = ztab2&lt;/SUB&gt;id&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the above...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2009 09:33:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424906#M1244891</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-24T09:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: LEFT OUTER JOIN and INNER JOIN in same select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424907#M1244892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately none of the above answers are correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to put up a more general question then. Say you have 3 tables where table 1 &amp;gt; 2 &amp;gt; 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;meaning 1 has more rows than 2, 2 have more rows than 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, left join table 1 and 2 and inner join table 2 and 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would the resultset be if you wrote this in one single abap statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My guess is it should be all the rows from table 1 since the LEFT JOIN statements will disregard that there are no rows on the right hand side that matches.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My example unfortunately does not show this why i am wondering what I am missing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2009 10:08:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424907#M1244892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-24T10:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: LEFT OUTER JOIN and INNER JOIN in same select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424908#M1244893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

Select a~fld1 a~fld2 a~fld3 a~fld4
from ztab1 as a left outer join ztab2 as b
on a~fld1 = b!fld1
and a~fld2=b~fld2
and a~fld3 = b~fld3
inner join ztab3 as c
on b~fld1 = c~fld1
and b~fld2 = c~fld3
into table itab.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2009 10:11:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424908#M1244893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-24T10:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: LEFT OUTER JOIN and INNER JOIN in same select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424909#M1244894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the following which will work fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select a&lt;SUB&gt;field from ztab1 as a left outer join ztab2 as b on a&lt;/SUB&gt;field = b~field&lt;/P&gt;&lt;P&gt;inner join ztab3 as c on b&lt;SUB&gt;field = c&lt;/SUB&gt;field into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards,&lt;/P&gt;&lt;P&gt;suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2009 10:17:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424909#M1244894</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-24T10:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: LEFT OUTER JOIN and INNER JOIN in same select</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424910#M1244895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Baran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using inner join for tab2 and tab3 is restricting with the less value table tab3.&lt;/P&gt;&lt;P&gt;Try to use left join twice, if your intention is set the priority to tab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fernando Da Ró&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2009 10:28:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/left-outer-join-and-inner-join-in-same-select/m-p/5424910#M1244895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-24T10:28:11Z</dc:date>
    </item>
  </channel>
</rss>

