SAND CDBMS SQL Reference Guide
Date/Time Arithmetic

 

Previous Topic:
Interval Arithmetic
Chapter Index
Next Topic:
Interval Comparisons

 

Interval Aggregation

Intervals of the same type can be grouped together using a subset of the aggregation functions. When intervals are aggregated in this manner, the resulting value is the same interval type.

The following aggregate functions can be used to group interval values:


Example

given SMALLINT column c1:

c1
10
90
55
33
48

MIN (C1 * 10 DAYS) = 100 (days)

MAX (C1 - 5 SECONDS) = 85 (seconds)

AVG (C1 + 10 HOURS) = 36047 (seconds)

SUM (C1 - 1 MINUTE) = -64 (seconds)