<?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>Question Re: How to use sub select &amp; left outer join? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaa-p/498787#M92007</link>
    <description>&lt;P&gt;Select...Endselect construct is not advised to be used due to performance issues.&lt;/P&gt;
  &lt;P&gt;Instead, refactor as below-&lt;/P&gt;
  &lt;P&gt;1. Fetch data from VBRL in an internal table with a where condition matching your requirement.&lt;/P&gt;
  &lt;P&gt;2. Fetch all records from VBRK table with a where condition matching your requirement.&lt;/P&gt;
  &lt;P&gt;3. Loop at the result table of step2. &lt;/P&gt;
  &lt;P&gt;4. Inside the loop at step 3, put a loop at table of step 1 and pick the requisite records with condition similar to where clause of JOIN.&lt;/P&gt;
  &lt;P&gt;5. Create a final table(similar to l_it_fakbuch) and use.&lt;/P&gt;
  &lt;P&gt;* You can also try implementing parallel cursor based on nature of data.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2017 05:05:45 GMT</pubDate>
    <dc:creator>Ankit_Maskara</dc:creator>
    <dc:date>2017-12-14T05:05:45Z</dc:date>
    <item>
      <title>How to use sub select &amp; left outer join?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaq-p/498786</link>
      <description>&lt;P&gt;I'm trying to perform the below sql-statement:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/97603-sql-statement.png" /&gt;&lt;/P&gt;
  &lt;P&gt;But there I got a syntax error on line 43, which says the select statement is not allowed here.&lt;/P&gt;
  &lt;P&gt;I tried also&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/97601-sql-statement-1.png" /&gt;&lt;/P&gt;
  &lt;P&gt;the error message says "SELECT" is in ABAP-Dictionay not as table, projection or db-view declaerd. Finally I modified the sql statement as below &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/97602-sql-statement21.png" /&gt;&lt;/P&gt;
  &lt;P&gt;and got the error message: 'JOIN' was expected here.&lt;/P&gt;
  &lt;P&gt;How can sub select be used after a &lt;STRONG&gt;left outer join&lt;/STRONG&gt; or &lt;STRONG&gt;inner join&lt;/STRONG&gt; statement as table correctly?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 04:20:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaq-p/498786</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-12-14T04:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sub select &amp; left outer join?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaa-p/498787#M92007</link>
      <description>&lt;P&gt;Select...Endselect construct is not advised to be used due to performance issues.&lt;/P&gt;
  &lt;P&gt;Instead, refactor as below-&lt;/P&gt;
  &lt;P&gt;1. Fetch data from VBRL in an internal table with a where condition matching your requirement.&lt;/P&gt;
  &lt;P&gt;2. Fetch all records from VBRK table with a where condition matching your requirement.&lt;/P&gt;
  &lt;P&gt;3. Loop at the result table of step2. &lt;/P&gt;
  &lt;P&gt;4. Inside the loop at step 3, put a loop at table of step 1 and pick the requisite records with condition similar to where clause of JOIN.&lt;/P&gt;
  &lt;P&gt;5. Create a final table(similar to l_it_fakbuch) and use.&lt;/P&gt;
  &lt;P&gt;* You can also try implementing parallel cursor based on nature of data.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 05:05:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaa-p/498787#M92007</guid>
      <dc:creator>Ankit_Maskara</dc:creator>
      <dc:date>2017-12-14T05:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sub select &amp; left outer join?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaa-p/498788#M92008</link>
      <description>&lt;P&gt;Because there is only one condition (vbrl~zz_fbuda_min in datum) after WHERE clause, I have decided to put this condition after ON clause. I think the implication will be the same. Please correct me if I'm wrrong. At the moment my sql query looks like below&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/98528-sql-query.png" /&gt;&lt;/P&gt;
  &lt;P&gt;But the question is and remains, how a sub select can be used after a LlEFT OUTER JOIN resp. INNER JOIN?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 15:47:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaa-p/498788#M92008</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-12-14T15:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use sub select &amp; left outer join?</title>
      <link>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaa-p/498789#M92009</link>
      <description>&lt;P&gt;You can check here for Select subquery syntax with Inner Join - &lt;A href="https://archive.sap.com/discussions/thread/1326078" target="test_blank"&gt;https://archive.sap.com/discussions/thread/1326078&lt;/A&gt;.&lt;/P&gt;
  &lt;P&gt;Still from performance perspective I will not advise your select query. &lt;/P&gt;
  &lt;P&gt;Please avoid select....endselect and in the where clause use positive conditions like IN or EQ etc. Using negatives line &amp;lt;&amp;gt; degrades the runtime.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 05:35:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/how-to-use-sub-select-left-outer-join/qaa-p/498789#M92009</guid>
      <dc:creator>Ankit_Maskara</dc:creator>
      <dc:date>2017-12-19T05:35:15Z</dc:date>
    </item>
  </channel>
</rss>

