<?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: Optimized query in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168411#M486089</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;&lt;/P&gt;&lt;P&gt;I would prefer sort the table based on the logon time in desending which will return the last logon time from which you can use select single which will retrieve the data required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kishore&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Feb 2006 12:39:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-02-09T12:39:57Z</dc:date>
    <item>
      <title>Optimized query</title>
      <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaq-p/1168407</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 have table in the following format &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USERID     LDATE      LTIME &lt;/P&gt;&lt;P&gt;                            &lt;/P&gt;&lt;P&gt;0000000001 2006.02.09 172005&lt;/P&gt;&lt;P&gt;0000000001 2006.02.09 172055&lt;/P&gt;&lt;P&gt;0000000001 2006.02.09 172224&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I need to get the users earlier logon date &amp;amp; time(Only single record). I this case I have to pick up the third record  ie  0000000001 2006.02.09 172224&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; For getting this record how we can use SELECT Single or SELECT UPTO 1 Rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; My WHERE condition will be like this,&lt;/P&gt;&lt;P&gt;  where userid eq lv_userid and &lt;/P&gt;&lt;P&gt;        ldate  le sy-datum  and &lt;/P&gt;&lt;P&gt;        ltime  lt sy-uzeit.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I Dont want to read all the record by SELECT ENDSELECT and then validate to pickup the latest one ( Since this table will contain huge number of records). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; It would be great if anyone higlight a optimized select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 12:06:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/optimized-query/qaq-p/1168407</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T12:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Optimized query</title>
      <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168408#M486086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raja, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; You can use sort statment by Comparing the log on time field. Then you delete the other unwanted entries. So u will have single record with earlier log on time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Srinivas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 12:09:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168408#M486086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T12:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Optimized query</title>
      <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168409#M486087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi raja,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. U may have to use something like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT EBELN MIN( AEDAT ) FROM EKKO&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE EKKO&lt;/P&gt;&lt;P&gt;GROUP BY EBELN AEDAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your case.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------" /&gt;&lt;P&gt;SELECT USERID MIN( LDATE ) MIN( LTIME )&lt;/P&gt;&lt;P&gt;FROM DBTABLE&lt;/P&gt;&lt;P&gt;GROUP BY USERID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. U can insert your where conditions .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Amit Mittal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 12:19:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168409#M486087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T12:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Optimized query</title>
      <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168410#M486088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;When it is returning a single record selectsingle is preferred to select . The syntax of using selectsingle is similar to select statement except it will not have endselect.Tell me if you are not able to do can give you more information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sudheer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 12:20:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168410#M486088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T12:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Optimized query</title>
      <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168411#M486089</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;&lt;/P&gt;&lt;P&gt;I would prefer sort the table based on the logon time in desending which will return the last logon time from which you can use select single which will retrieve the data required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kishore&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 12:39:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168411#M486089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T12:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Optimized query</title>
      <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168412#M486090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Can you please highlight how to sort a database table by certain fields . I this case I have to sort my database table by date and time  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 12:58:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168412#M486090</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T12:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Optimized query</title>
      <link>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168413#M486091</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;   Goto SE11&lt;DEL&gt;&amp;gt;&amp;lt;b&amp;gt;utilities&amp;lt;/b&amp;gt;&lt;/DEL&gt;&amp;gt;&amp;lt;b&amp;gt;database utility&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;   click on the &amp;lt;b&amp;gt;storage parameters&amp;lt;/b&amp;gt; push button&lt;/P&gt;&lt;P&gt;   click on &amp;lt;b&amp;gt;Indexes&amp;lt;/b&amp;gt; push button&lt;/P&gt;&lt;P&gt;   there in the &amp;lt;b&amp;gt;index definition&amp;lt;/b&amp;gt; U give the field&lt;/P&gt;&lt;P&gt;   names and check the check box for &amp;lt;b&amp;gt;DESCENDING&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;   Award Points if this helps...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;GSR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 13:13:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/optimized-query/qaa-p/1168413#M486091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T13:13:06Z</dc:date>
    </item>
  </channel>
</rss>

