SUM()

Aggregate. Returns the sum of the values of a given expression over multiple rows.

Syntax

SUM( [DISTINCT] expression )
Data Types

Return

expression

Integer

Integer

Long

Long

Float

Float

Interval

Interval

Example

The following example calculates the sum of the values in the Volume column over the last 5 minutes:

INSERT INTO OutStream
SELECT SUM(Volume) AS VolumeSum
FROM Trades KEEP 5 MINUTES;