10 Replies Latest reply: Oct 6, 2016 3:52 AM by Dennis Odenbreit RSS

    Calculate values (difficult)

    Dennis Odenbreit

      Hi there,

       

      I have the following problem:

       

      I have a table containing article-data (sample-data):

       

      ARTICLE_IDPRODUCTGROUP_IDSTARTDATEADDED_AT_DATEVALUE
      1111100
      1151200
      2211300
      3213400

       

      Now what I need to do is to add a field to every row of this table.

      Those fields are calculated by summing up all values of the table which have the same productgroup-id as in the current row and also need to have added_at_date in between the startdate and the startdate + 7.

       

      Is there an efficient way to solve this problem?

       

      I tried to create a new table called productgroup, which contains data like the productgroup_id, added_ad_date and dailyvalue (dailyvalue is an accumulation of all values for every productgroup_id and added_ad_date).

      Doing so I am clueless about how to accumulate the data out of this table for every article_id in the article-table, since it would need to be accumulated for every row over a dynamic amount of rows in the productgroup-table.

       

      I hope you can help me with ideas or techniques to solve this problem