Previous Topic: Group Aggregation Using Explicitly Indexed Repeating Group ViewsNext Topic: Examples


Group Aggregation With Selection and Sort Criteria

You can change the previous example using implicit indexing to select only job grades 10 and above and to rank them by the number of employees as shown in the following example:

SUMMARIZE EACH GROUP OF employee 
WITH THE SAME employee job_grade 
TARGETING repeating_group_local FROM THE BEGINNING UNTIL FULL 
PLACING employee job_grade INTO local employee job_grade 
PLACING GROUP count(OCCURRENCES) INTO local ief_supplied count 
SORTED BY DESCENDING GROUP count(OCCURRENCES)
SORTED BY ASCENDING employee job_grade
WHERE DESIRED employee job_grade IS GREATER OR EQUAL TO 10

In this example, GROUP count(OCCURRENCES) is the primary sort key because it occurs first. We are using employee job grade as a secondary sort key in case some job grades have the same number of employees.