Calculating Overall Totals
To calculate totals for the entire table, you must use the word OVERALL in the TOTALS clause. In this case, aggregate functions values for all the records of the table will be calculated.
Example:
SELECT Doc.Product, Doc.Count, Doc.Reference.Number, Doc.Reference.Recipient
FROM Document.ExpInvoice.Contents AS Doc
TOTALS SUM(Count) BY OVERALL
Query result:
Product
Count
Number
Recipient
238
Faucet
10
001
Urupinsk products
Faucet
8
003
“Master” Store
Faucet
44
003
“Giant” Store
Faucet
22
003
Urupinsk products
Plunger
5
001
Urupinsk products
Plunger
1
003
“Master” Store
Plunger
14
004
“Giant” Store
Table
1
001
Urupinsk products
Table
15
002
“Furniture” Store
Table
10
004
“Giant” Store
Chair
55
002
“Furniture” Store
Chair
5
003
“Master” Store
Chair
32
004
“Giant” Store
Chair
16
005
Urupinsk products