hi
i have 1 table with order(numordine) and order items (ccoar)
NUMORDINE | CCOAR | DTCRE | DTCTB |
---|
ORD1 | ART1 | 20140606 | 20140607 |
ORD1 | ART2 | 20140606 | 20140608 |
ORD2 | ART1 | 20140705 | 20140706 |
ORD2 | ART3 | 20140609 | 20140611 |
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
)