SUM function in Amazon QLDB
In Amazon QLDB, use the SUM
function to return the sum of the input field
or expression values. This function works with numeric values and ignores null or
missing values.
Syntax
SUM (
expression
)
Arguments
expression
-
The field name or expression of a numeric data type that the function operates on.
Data types
Supported argument types:
-
int
-
decimal
-
float
Supported return types:
-
int
– For integer arguments -
decimal
– For decimal or floating point arguments
Examples
SELECT SUM(r.PendingPenaltyTicketAmount) FROM VehicleRegistration r -- 735.95 SELECT SUM(a) FROM << { 'a' : 1 }, { 'a': 2 }, { 'a': 3 } >> -- 6