Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey all here is my example
ID trx Amount
1211 1 200
1211 1 200
1211 2 300
1211 2 100
I want my result to be like this
ID trx Count(trx) Sum(Amount)
1211 1 2 400
1211 2 2 400
Please how can i write this in the script?
Thank you.
LOAD
ID
, trx
, Count(trx) as TotalCount
, Sum(Amount) as TotalAmount
resident yourtable
group by ID, trx;
TabA:
LOAD * Inline [
ID , trx, Amount
1211 , 1 , 200
1211 , 1 , 200
1211 , 2 , 300
1211 , 2 , 100];
TabB: NoConcatenate
LOAD ID, trx, sum(Amount) as Amount, Count(trx) as num Resident TabA Group By ID, trx;
DROP Table TabA;