5 Replies Latest reply: Sep 13, 2018 4:41 AM by Muhammad Hazim Muhammad Alif RSS

    Division in same field

    Muhammad Hazim Muhammad Alif

      Hi experts,

       

      Below is the table

       

          A    B    C

          1    2    0/18

          4    3    0.27

          5    6    0.54

       

      Requirement:

      C = B/SUM(B)

       

      eg : 2/11

       

      Below is my load script

       

      tableA:

      Load

          A,

          B,

          Sum(B) as totalB

      from ...

      group by A,B;

       

      tableB:

      Load

          A,

          B,

          totalB,

          B/totalB as C

      Resident tableA;


      drop table tableA;


      this codes will produce this result

       

          A    B    C

          1    2    1

          4    3    1

          5    6    1


      because this formula B/totalB = B/B


      Any idea how?


      Thank you in advance!