<?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: Why does sum functionality on table join return incorrect values in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294154#M1989682</link>
    <description>&lt;P&gt;The first fact you are missing is that when you have table C in your query, the sum of B column is altered because the number of B rows is multiplied by the number of C rows for each A row.&lt;/P&gt;&lt;P&gt;Workaround -&amp;gt; See Chau answer.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Sep 2020 06:46:19 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2020-09-19T06:46:19Z</dc:date>
    <item>
      <title>Why does sum functionality on table join return incorrect values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294151#M1989679</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;I am using 3 tables Table a ,table b and table c.&lt;/P&gt;
  &lt;P&gt;On using sum on fields from table b and c i am getting incorrect values on both fields and both seem to be greater than correct values.&lt;/P&gt;
  &lt;P&gt;On joining these tables using a query as follows&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;Select from Table A left join Table B on a~field = b~field
                                Left join Table on a~field = c~field
Fields
a~field1,a~field2 ,sum( b~field1 ) as qty1,sum( c~field1 ) as qty2


into  internal_Table where .......
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Now if i leave out table c then values in sum for table b are correct ,but i need to sum both table fields on join with table a.&lt;/P&gt;
  &lt;P&gt;Am i missing something ?&lt;/P&gt;
  &lt;P&gt;Thanking you &lt;/P&gt;</description>
      <pubDate>Fri, 18 Sep 2020 19:40:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294151#M1989679</guid>
      <dc:creator>nidak2501</dc:creator>
      <dc:date>2020-09-18T19:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why does sum functionality on table join return incorrect values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294152#M1989680</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can split it into two select statements, one for group table A and B, and one for A and C, after that, join two groups and you will see data.&lt;BR /&gt;When you group A and B ==&amp;gt; it will return dataset X&lt;BR /&gt;SQL will trigger continuously X with C ==&amp;gt; data will be incorrect &lt;BR /&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 03:01:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294152#M1989680</guid>
      <dc:creator>chau1995</dc:creator>
      <dc:date>2020-09-19T03:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why does sum functionality on table join return incorrect values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294153#M1989681</link>
      <description>&lt;P&gt;Hi Chau,&lt;/P&gt;&lt;P&gt;I understand that splitting them both would give proper result, but my plan requires joining 5 more table with table a in similar manner for&lt;/P&gt;&lt;P&gt;getting sum( ) values ,this would mean splitting them all individually.&lt;/P&gt;&lt;P&gt;Isnt there some methodology for sum and joins to work accordingly?&lt;/P&gt;&lt;P&gt;Regards,   &lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 06:04:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294153#M1989681</guid>
      <dc:creator>nidak2501</dc:creator>
      <dc:date>2020-09-19T06:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why does sum functionality on table join return incorrect values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294154#M1989682</link>
      <description>&lt;P&gt;The first fact you are missing is that when you have table C in your query, the sum of B column is altered because the number of B rows is multiplied by the number of C rows for each A row.&lt;/P&gt;&lt;P&gt;Workaround -&amp;gt; See Chau answer.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 06:46:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294154#M1989682</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-09-19T06:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why does sum functionality on table join return incorrect values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294155#M1989683</link>
      <description>&lt;P&gt;You can do it by using window function in SQL. Maybe you can refer it in this link: &lt;A href="https://blogs.sap.com/2020/09/07/another-ways-to-calculate-accumulate-and-total-in-amdp/" target="test_blank"&gt;https://blogs.sap.com/2020/09/07/another-ways-to-calculate-accumulate-and-total-in-amdp/&lt;/A&gt;&lt;BR /&gt;Hope this helps!!&lt;/P&gt;</description>
      <pubDate>Sat, 19 Sep 2020 11:11:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-does-sum-functionality-on-table-join-return-incorrect-values/m-p/12294155#M1989683</guid>
      <dc:creator>chau1995</dc:creator>
      <dc:date>2020-09-19T11:11:44Z</dc:date>
    </item>
  </channel>
</rss>

