<?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: select and join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372111#M525590</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you use the select st inside the looop ... It will effect the performance..&lt;/P&gt;&lt;P&gt;Better u can use the For all enteries...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jun 2007 12:26:40 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-14T12:26:40Z</dc:date>
    <item>
      <title>select and join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372106#M525585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I want to know when is good to do join between 2 tables&lt;/P&gt;&lt;P&gt;or to do select and loop and in the loop select single&lt;/P&gt;&lt;P&gt;When it good to use for all entries&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;have a nice day&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 12:20:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372106#M525585</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T12:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: select and join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372107#M525586</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;Its good to use JOIN than having one SELECT and then LOOPING at the result table and executing SELECT SINGLE in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should never have SELECT inside a LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having SELECT inside a loop will hinder the performance of the program drastically.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 12:22:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372107#M525586</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-06-14T12:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: select and join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372108#M525587</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;JOIN is faster to fetch the data from database tables provided they have some connecting fields in both tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for all entries&lt;/P&gt;&lt;P&gt;The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... FOR ALL ENTRIES IN &amp;lt;itab&amp;gt; WHERE &amp;lt;cond&amp;gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;cond&amp;gt; may be formulated as described above. If you specify a field of the internal table &amp;lt;itab&amp;gt; as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If &amp;lt;itab&amp;gt; is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The internal table &amp;lt;itab&amp;gt; must have a structured line type, and each field that occurs in the condition &amp;lt;cond&amp;gt; must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select single and Upto 1 rows&lt;/P&gt;&lt;P&gt;Difference Between Select Single and Select UpTo One Rows &lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to read data from &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to check if entries exist. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points for useful Answers&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 12:25:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372108#M525587</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T12:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: select and join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372109#M525588</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;using joins can cause performance issues.&lt;/P&gt;&lt;P&gt;even select * should be avoided as much as possible as it causes performance degradation.&lt;/P&gt;&lt;P&gt;to avoid loop inside loop &amp;lt;b&amp;gt;it is advisable to use for all entries'&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;select single should always be the first option to use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;ravish&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;&amp;lt;b&amp;gt;plz dont forget to reward points if helpful&amp;lt;/b&amp;gt;&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 12:25:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372109#M525588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T12:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: select and join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372110#M525589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;select - join statement is always better than using a select statement in a loop.&lt;/P&gt;&lt;P&gt;avoid using select single in a loop.&lt;/P&gt;&lt;P&gt;for all entries is also prefered. if u have to join more than 2 tables then i suggest you to use for all entries.&lt;/P&gt;&lt;P&gt;reward points if helpful&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;fazeel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 12:25:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372110#M525589</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T12:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: select and join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372111#M525590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you use the select st inside the looop ... It will effect the performance..&lt;/P&gt;&lt;P&gt;Better u can use the For all enteries...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2007 12:26:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-and-join/m-p/2372111#M525590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-14T12:26:40Z</dc:date>
    </item>
  </channel>
</rss>

