Skip to main content

Notifications

Aggregation

To obtain a sum of records, consider instructing the database to calculate the sum
and only return the result, as an alternative to reading all the records and making
the aggregation yourself. To receive a sum specified for one or more fields in the
table, combine the aggregation with a group by clause. The following
aggregation clauses are available.


Aggregation clause Description
sum Returns the sum of the values in a field.
avg Returns the average of the values in a field.
maxof Returns the maximum of the values in a field.
minof Returns the minimum of the values in a field.
count Returns the number of records that satisfy the statement.


The following illustrates using aggregate functions:


1
2
3
4
select sum(qty) from inventTrans;
qty = inventTrans.amountMST;
select count(recId) from inventTrans;
countInventTrans = ledgerTrans.recId;

Best Regards,
Hossein Karimi

Comments

*This post is locked for comments