Enform Plus Reference Manual

Enform Plus Language Elements
Enform Plus Reference Manual422684-001
3-18
Qualification Aggregates
Qualification Aggregates and Target Records
A qualification aggregate functions as a full subquery. This means that Enform Plus
computes the value for the aggregate over all the records in the database file, (not over
the target records selected in the rest of the LIST or FIND statement) and uses the result
as input to the target list.
For example, the statement:
LIST BY job,
empname,
AVG (salary)
WHERE salary < AVG (salary);
Figure 3-5. Query Outline of Qualification Aggregate With OVER Syntax
OPEN employee;
LIST regnum,
branchnum,
WHERE salary GT AVG( salary OVER regnum );
The qualification aggregate value for each group is:
regnum AVG salary
1 24666
2 28333
5 38000
99 39500
If employee has the following form when grouped by regnum and branchnum:
regnum branchnum salary
1 1 36000
19000
25000
26000
12000
2 30000
2 1 37000
25000
23000
5 3 38000
99 1 39500
The report produced is:
Region Branch
------ ------
2 1
1 1
1 1
1 1
1 2