Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to sum by group?

Hi guys,


I met one problem, how to obtain each group's sum, and to save this sum as one field in script.

The scenario is I need to monitor each group's quantity, once it exceeds one value(like 2 as below), the system will send alert.

Thank you very much!

groupquantity
A1
A2
B2
C3
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author


load  group,

        sum(quantity)

from tablename

group by group;

View solution in original post

2 Replies
Anonymous
Not applicable
Author


load  group,

        sum(quantity)

from tablename

group by group;

amit_saini
Master III
Master III

Jack,

Try this:

max(aggr(sum(quantity),group))

Thanks,

AS