Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
luca_bellotti
Contributor III
Contributor III

Group by?

Hi to everyone,

I need help with the following problem.

I have loaded a table by script

TABLE1

NAMESUB_NAMEVALUE1VALUE2
AA110
AA101
AA220
AA310
AA410
AA510

I would like to have another table like this.

TABLE2

NAMESUB_NAMEVALUE1VALUE2
AA111
AA220
AA310
AA410
AA510

If anyone could help me I'll be grateful.

Thanks

1 Solution

Accepted Solutions
felipedl
Partner - Specialist III
Partner - Specialist III

Hi,

Do the following:

Load

     NAME,

     SUB_NAME,

     sum(VALUE1) as VALUE1

     sum(VALUE2) as VALUE2

From [Whatever]

group by NAME,SUB_NAME;

View solution in original post

3 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi,

Do the following:

Load

     NAME,

     SUB_NAME,

     sum(VALUE1) as VALUE1

     sum(VALUE2) as VALUE2

From [Whatever]

group by NAME,SUB_NAME;

luca_bellotti
Contributor III
Contributor III
Author

Hi Felip,

thank you for the help. I've already tried this solution but it doesn't work. Probably I'm missing something.

Here is my situation

TABLE1:

Load

     NAME,

     SUB_NAME,

     VALUE1,

     VALUE2,

From [....]

TABLE2:

Load *,

     Sum (VALUE1) as VALUE1,

     Sum (VALUE1) as VALUE2

Resident TABLE1

Group By NAME, SUBNAME;

Drop Table TABLE1;

agarbuzyuk
Partner - Contributor
Partner - Contributor

Hi,

Table1:

Load * inline [

NAME, SUB_NAME, VALUE1, VALUE2

A, A1, 1, 0

A, A1, 0, 1

A, A2, 2, 0

A, A3, 1, 0

A, A4, 1, 0

A, A5, 1, 0

];

NoConcatenate Table2:

Load NAME

,SUB_NAME

,sum(VALUE1) as VALUE1

,sum(VALUE2) as VALUE2

Resident Table1

group by NAME

,SUB_NAME

;

Drop Table Table1;