<?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 statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835598#M355645</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;Selection should be unique (Fields) when you are hitting the database table. Even if you work around some way of selectiong it, it would not be suggestable. So you better get all the records into an internal table and then use your conditions to modify the same or have an other internal table to have the actual data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select dat1&lt;/P&gt;&lt;P&gt;from tab1&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;where dat1 gt dat2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. &lt;/P&gt;&lt;P&gt;Select dat2&lt;/P&gt;&lt;P&gt;from tab1&lt;/P&gt;&lt;P&gt;appending table itab&lt;/P&gt;&lt;P&gt;where dat1 lt dat2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- &lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jan 2007 09:08:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-29T09:08:20Z</dc:date>
    <item>
      <title>select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835593#M355640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;may i know how to write a select statement to select datum2 if datum2 is greater than datum1 else select datum1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datum1 and datum2 in tableB. tableA inner join with tableB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 08:58:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835593#M355640</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T08:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835594#M355641</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;1. select the records into an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use READ statement to fetch datum1 and datum2 rom that itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. use IF condition to find the bigger one among the dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 09:02:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835594#M355641</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2007-01-29T09:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835595#M355642</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 think you need two queries since we cannot have the select clause dynamic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideal would be SELECT DATUM2 FROM TABLEA INNER JOIN TABLEB ON&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt; WHERE DATUM2&amp;gt; DATUM1 AND.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc of this is not 0 then directly fetch DATUM1 with same where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 09:05:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835595#M355642</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-01-29T09:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835596#M355643</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 think you need two queries since we cannot have the select clause dynamic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ideal would be SELECT DATUM2 FROM TABLEA INNER JOIN TABLEB ON&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt; WHERE DATUM2&amp;gt; DATUM1 AND.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc of this is not 0 then directly fetch DATUM1 with same where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 09:05:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835596#M355643</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-01-29T09:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835597#M355644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i think it is not possible in sql...&lt;/P&gt;&lt;P&gt;but you can try like this..&lt;/P&gt;&lt;P&gt;data : v_date1 like sy-datuem,&lt;/P&gt;&lt;P&gt;         v_date2 like sy-datuem.&lt;/P&gt;&lt;P&gt;select b&lt;SUB&gt;bate1 b&lt;/SUB&gt;date2 into (v_date1, v_date2) from dbtab as a inner join dbtab1 as b on a&lt;SUB&gt;f1 = b&lt;/SUB&gt;f1 where &amp;lt;condn&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if v_date1 ge v_date2.&lt;/P&gt;&lt;P&gt;itab-date = v_date1.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;itab-date = v_date2.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append  itab.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;shiba dutta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 09:06:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835597#M355644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T09:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835598#M355645</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;Selection should be unique (Fields) when you are hitting the database table. Even if you work around some way of selectiong it, it would not be suggestable. So you better get all the records into an internal table and then use your conditions to modify the same or have an other internal table to have the actual data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select dat1&lt;/P&gt;&lt;P&gt;from tab1&lt;/P&gt;&lt;P&gt;into table itab&lt;/P&gt;&lt;P&gt;where dat1 gt dat2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. &lt;/P&gt;&lt;P&gt;Select dat2&lt;/P&gt;&lt;P&gt;from tab1&lt;/P&gt;&lt;P&gt;appending table itab&lt;/P&gt;&lt;P&gt;where dat1 lt dat2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- &lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jan 2007 09:08:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/1835598#M355645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-29T09:08:20Z</dc:date>
    </item>
  </channel>
</rss>

