0 Replies Latest reply: Jul 24, 2014 5:42 AM by alessandro tediosi RSS

    help from aggr script in load statement

      hi

      i have 1 table with order(numordine) and order items (ccoar)


      NUMORDINECCOARDTCREDTCTB
      ORD1ART12014060620140607
      ORD1ART22014060620140608
      ORD2ART12014070520140706
      ORD2ART32014060920140611


      i need calculate from load script the avg difference from (dtcre and dtctb group by for ccoar) group by for any numordine !


      how can I make a group by in another group by in only load statement?

      in load script i can't use with aggr function..

      Aggr(DISTINCT

          AVG(

              if (

                  Aggr(DISTINCT DTCTB,CCOAR,DTCTB)>0 and Aggr(DISTINCT DTCRE,CCOAR,DTCRE)>0

                  ,

                  Interval(date(date#(Aggr(DISTINCT DTCTB,CCOAR,DTCTB),'YYYYMMDD'),'YYYYMMDD') - date(date#(Aggr(DISTINCT DTCRE,CCOAR,DTCRE),'YYYYMMDD'),'YYYYMMDD'),'d')

              )

          )

          ,NUMORDINE

      )