Previous Topic: Subgroup Aggregation With Multiple Common AttributesNext Topic: DATABASE EXCEPTION Statement


Use Expressions as Aggregate Function Arguments

The rules for using expressions as aggregate function arguments for a SUMMARIZE EACH statement are the same as those for a SUMMARIZE statement. For more information, see Use Expressions as Functions in the section Add SUMMARIZE Entity Action.

For example, to retrieve the total billing amount (the sum of the quantities times the price of the ordered products) for each product, you can use the following statement:

SUMMARIZE EACH GROUP OF order_line 
product 
WITH THE SAME product id 
PLACING product id INTO local product id 
PLACING GROUP sum(order_line qty ordered * product unit price) 
INTO local ief_supplied total_currency 
WHERE DESIRED product is_ordered_in DESIRED order_line