1 Reply Latest reply: Mar 6, 2014 7:24 PM by Felipe Dutra RSS

    set analysis

      Can someone help me on this question?

      I have a table contain quite a few fields like below. Lets say two of fields are A and B. I want to calcuate sum(A*B). The question is that I expect sum(A*B) equals to 10+2+18. but it is not.


      table:

      ---------------------------

      key, A, B, A*B...

      1    , 2, 5, 10,...

      2    , 1, 2, 2,...

      3    , 6, 3, 18,...

      ---------------------------

      if I select key field 1, the table become like below, just have the first row.

      ------------------------------

      key, A, B, A*B...

      1    , 2, 5, 10,...

      ------------------------------


      I expected sum(A*B) = 10. But its calcuated result is (2+1+6)*5=45.

      if I did sum(B)*A it will give me 5*2=10

      I am confused. Under the current selection, A should just be number 2, why when I did sum(A*B), it sum all A value (2, 1, 6)?


      Thanks,