Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following as my load script.
LOAD text(inventory_num) as inv_num, sum(amt_paid) as amt_paid_2014_06 FROM C:\Downloads\invpaid.txt (txt, codepage is 1252, embedded labels, delimiter is '~') GROUP by inv_num;
The invpaid.txt file has inventory numbers and the amount paid for each number. Sometimes there are multiple payments per inventory number. I want to consolidate the data so that I have only unique inventory numbers with the total amount paid for each number.
For example
inv_num | amt_paid |
---|---|
a1 | 30 |
a1 | 31 |
a2 | 30 |
The above table should turn into
inv_num | amt_paid |
---|---|
a1 | 61 |
a2 | 30 |
Try this :
LOAD text(inventory_num) as inv_num, sum(amt_paid) as amt_paid_2014_06 FROM C:\Downloads\invpaid.txt (txt, codepage is 1252, embedded labels, delimiter is '~') GROUP by inventory_num ;
Try this:
LOAD text(inventory_num) as inv_num, sum(amt_paid) as amt_paid_2014_06 FROM C:\Downloads\invpaid.txt (txt, codepage is 1252, embedded labels, delimiter is '~') GROUP by text(inventory_num);
you cannot use alias ...
Try this :
LOAD text(inventory_num) as inv_num, sum(amt_paid) as amt_paid_2014_06 FROM C:\Downloads\invpaid.txt (txt, codepage is 1252, embedded labels, delimiter is '~') GROUP by inventory_num ;
You are grouping by a field that has not yet been defined.
try:
LOAD text(inventory_num) as inv_num, sum(amt_paid) as amt_paid_2014_06 FROM C:\Downloads\invpaid.txt (txt, codepage is 1252, embedded labels, delimiter is '~') GROUP by inventory_num;
Regards
SKG
Thanks Bill! Your solution worked.