<?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: query in select statment in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566939#M256123</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not &lt;/P&gt;&lt;P&gt;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, &lt;/P&gt;&lt;P&gt;it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key &lt;/P&gt;&lt;P&gt;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) &lt;/P&gt;&lt;P&gt;you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns &lt;/P&gt;&lt;P&gt;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;&lt;/P&gt;&lt;P&gt;You can refer to the below link..&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Sep 2006 05:46:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-18T05:46:28Z</dc:date>
    <item>
      <title>query in select statment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566938#M256122</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;    what is the difference between,select single and &lt;/P&gt;&lt;P&gt;select upto one row .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a select statment .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;shankar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2006 05:44:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566938#M256122</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-18T05:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: query in select statment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566939#M256123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not &lt;/P&gt;&lt;P&gt;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, &lt;/P&gt;&lt;P&gt;it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key &lt;/P&gt;&lt;P&gt;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) &lt;/P&gt;&lt;P&gt;you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns &lt;/P&gt;&lt;P&gt;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;&lt;/P&gt;&lt;P&gt;You can refer to the below link..&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2006 05:46:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566939#M256123</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-18T05:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: query in select statment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566940#M256124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SELECT SINGLE searches for a unique row in the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT UPTO 1 ROWS retrives the first row that matches the selection criteria(there may be more than 1 in the database). This is used mainly for Validation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Meera&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2006 05:48:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566940#M256124</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-18T05:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: query in select statment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566941#M256125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In select single you have to where clause&lt;/P&gt;&lt;P&gt;In select up to 1 rows no need of where clause&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In select single it retrieves the record based on the where condition&lt;/P&gt;&lt;P&gt;In select up to 1 rows it retrieves the first record&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2006 05:50:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566941#M256125</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-18T05:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: query in select statment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566942#M256126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Difference is select upto 1 row will select all the records in that condition and then does some grouping or sorting and then outputs the record. Takes more time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But select single selects the forst row which meets that condition and gives the result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more details check blogs there is an article.&lt;/P&gt;&lt;P&gt;Keyword Performance tuning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2006 05:53:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566942#M256126</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-18T05:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: query in select statment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566943#M256127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To restrict the absolute number of lines included in the To read a single entry from the database, use the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE &amp;lt;cols&amp;gt; ... WHERE ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To ensure that the line can be uniquely identified, you must specify values for all of the fields of the primary key of the table in the WHERE clause. If the WHERE clause does not contain all of the key fields, the syntax check produces a warning, and the SELECT statement reads the first entry that it finds that matches the key fields that you have specified. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ... FROM &amp;lt;tables&amp;gt; UP TO &amp;lt;n&amp;gt; ROWS ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If &amp;lt;n&amp;gt; is a positive integer, the system reads a maximum of &amp;lt;n&amp;gt; lines. If &amp;lt;n&amp;gt; is zero, the system reads all lines that meet the selection criteria. If you use the ORDER BY clause as well, the system reads all lines belonging to the selection, sorts them, and then places the first &amp;lt;n&amp;gt; lines in the selection set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Abhishek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2006 05:53:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566943#M256127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-18T05:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: query in select statment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566944#M256128</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;The 'SELECT SINGLE' - &amp;gt; statement selects the first row in the database accrding to the 'WHERE' clause &lt;/P&gt;&lt;P&gt;If  multiple records  are there then only the first one will be returned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it might not be unique &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' - &amp;gt; returs the first set of the record set, which satisfies the WHERE condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;performance is high in this case&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helepd amrk points.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Sep 2006 05:54:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/query-in-select-statment/m-p/1566944#M256128</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-18T05:54:01Z</dc:date>
    </item>
  </channel>
</rss>

