<?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: Select from multiple tables in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586098#M4322193</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthias,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use ADD_DAYS Function in Inner Join Query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this. I hope It will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;SELECT&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; A.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"M_VALUE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt;, A.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"M_DATE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt;, B.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"E_EVENTID"&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;FROM&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; MEASUREMENT A&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;INNER&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;JOIN&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; EVENT B&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;ON&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; A.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"M_DATE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; = ADD_DAYS(B.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"E_DATE", -1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Muthu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Mar 2016 06:53:49 GMT</pubDate>
    <dc:creator>muthuram_shanmugavel2</dc:creator>
    <dc:date>2016-03-03T06:53:49Z</dc:date>
    <item>
      <title>Select from multiple tables</title>
      <link>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaq-p/11586095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I have a tab&lt;SPAN style="color: #575757;"&gt;le &lt;SPAN style="font-family: helvetica, arial; font-size: 12px;"&gt;MEASUREMENT&lt;/SPAN&gt;&lt;/SPAN&gt; (DATE, VALUE)&amp;nbsp; and one EVENT (EVENT-ID, DATE), now I want to select the value of a measurement one day before an event into a separate table &lt;SPAN style="font-size: 12px;"&gt;MEASUREMENT_BEFORE_EVENT&lt;/SPAN&gt;. Therefore I using following SQL statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;INSERT INTO "MEASUREMENT_BEFORE_EVENT" ("VALUE","DATE")&lt;/P&gt;
&lt;P&gt;SELECT "VALUE","DATE" FROM "MEASUREMENT"&lt;/P&gt;
&lt;P&gt;WHERE "DATE" IN (SELECT ADD_DAYS("EVENT-DATE",-1) FROM "EVENT" ORDER BY "EVENT_DATE" ASC);&lt;/P&gt;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt;"&gt;Now I would like to extend this and &lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;insert&lt;/SPAN&gt;&lt;SPAN style="font-size: 9pt;"&gt; also the EVENT-ID into MEASUREMENT_BEFORE_EVENT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;INSERT INTO "MEASUREMENT_BEFORE_EVENT" ("VALUE","DATE","EVENT-ID")&lt;/P&gt;
&lt;P&gt;SELECT "VALUE","DATE" (SELECT "DATE" FROM "EVENT") FROM "MEASUREMENT"&lt;/P&gt;
&lt;P&gt;WHERE "DATE" IN (SELECT ADD_DAYS("EVENT-DATE",-1) FROM "EVENT" ORDER BY "EVENT_DATE" ASC);&lt;/P&gt;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I do like this then I get&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;ERROR: single-row query returns more than one row&lt;/P&gt;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a possibility to do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 15:23:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaq-p/11586095</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-03-01T15:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select from multiple tables</title>
      <link>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586096#M4322191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthias,&lt;/P&gt;&lt;P&gt;the issue is on your inner query select "DATE" from "EVENT" you will need to do an inner join between your EVENT table and your MEASUREMENT table so that you can get multiple records in your select statement. once you get your select statement working then you can perform your insert operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Mar 2016 15:53:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586096#M4322191</guid>
      <dc:creator>SergioG_TX</dc:creator>
      <dc:date>2016-03-01T15:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select from multiple tables</title>
      <link>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586097#M4322192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thx Sergio,&lt;/P&gt;&lt;P&gt;But the problem is when I do a INNER JOIN I have only the &lt;SPAN style="color: #333333; font-size: 12px;"&gt;MEASUREMENT from the day of the event but not before a EVENT.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;I would need to use the ADD_DAY function in INNER JOIN&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 12:32:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586097#M4322192</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-03-02T12:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select from multiple tables</title>
      <link>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586098#M4322193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthias,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use ADD_DAYS Function in Inner Join Query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this. I hope It will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;SELECT&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; A.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"M_VALUE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt;, A.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"M_DATE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt;, B.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"E_EVENTID"&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;FROM&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; MEASUREMENT A&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;INNER&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;JOIN&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; EVENT B&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="x_MsoNormal" style="font-size: 11pt; font-family: Calibri, sans-serif; color: #212121;"&gt;&lt;STRONG style="color: #7f0055; font-size: 10pt; font-family: Consolas;"&gt;ON&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; A.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"M_DATE"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: black;"&gt; = ADD_DAYS(B.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas; color: #2a00ff;"&gt;"E_DATE", -1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Muthu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 06:53:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586098#M4322193</guid>
      <dc:creator>muthuram_shanmugavel2</dc:creator>
      <dc:date>2016-03-03T06:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Select from multiple tables</title>
      <link>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586099#M4322194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much, now it works well.&lt;/P&gt;&lt;P&gt;I tried it before to use &lt;SPAN style="color: #333333; font-size: 12px;"&gt;ADD_DAYS Function in Inner Join Query but I always got the same day back.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 10:01:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/select-from-multiple-tables/qaa-p/11586099#M4322194</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-03-03T10:01:59Z</dc:date>
    </item>
  </channel>
</rss>

