Aggregates
ENFORM Language Elements
058057 Tandem Computers Incorporated
3–17
Specifying the aggregate shown in Figure 3-3 is the same as specifying:
AVG(target-item-2);
The query groups target-item-1 and target-item-2 within by-item-2. The aggregate
AVG is used and the average value of target-item-2 is found by totaling all of the
values of target-item-2 and dividing that total by the number of target-item-2 values.
Notice that AVG target-item-2 prints as a separate column on the report with only one
non-blank entry. This entry corresponds to the aggregate value of all records in the
report.
When a target aggregate is specified in a FIND statement with OVER ALL either
present or assumed, only the first target-record contains the aggregate value. This
field is blank in all other target-records generated by the FIND statement.
Target Aggregate with OVER Syntax
If you specify a target aggregate in a LIST or FIND statement with the OVER syntax, a
single aggregated value is returned for each grouped value. Consider the query
outline and output diagram shown in Figure 3-4.
Figure 3-4. Query Outline of Target-Aggregate with OVER Syntax
Query outline:
LIST BY by-item-1,
BY by-item-2,
target-item-1
AVG(target-item-1 OVER by-item-2);
Output Diagram:
|---------|
by-item-1 by-item-2 | target- | AVG
| item-1 | target-item-1
--------- --------- |---------| -------------
xxxxxxx xxxxxxx | xxxxxxx | xxxxxxxxxxxxx
| xxxxxxx | (total/4)
| xxxxxxx |
| xxxxxxx |
|---------|
xxxxxxx | xxxxxxx | xxxxxxxxxxxxx
| xxxxxxx | (total/2)
|---------|
xxxxxxx xxxxxxx | xxxxxxx | xxxxxxxxxxxxx
| xxxxxxx | (total/3)
| xxxxxxx |
|---------|
Summary of Contents for ENFORM 058057
Page 6: ...New and Changed Information 058057 Tandem Computers Incorporated v...
Page 18: ...Preface xvi 058057 Tandem Computers Incorporated This page left intentionally blank...
Page 19: ...Preface 058057 Tandem Computers Incorporated xvii...
Page 269: ...Glossary Glossary 4 058057 Tandem Computers Incorporated This page left intentionally blank...