# Striim 3.9.4 / 3.9.5 documentation

##### Aggregate functions

To avoid unexpected results from a SELECT statement containing an aggregate function :

• Always include a GROUP BY clause.

• If selecting from a window, all fields other than the one in the GROUP BY clause should use an aggregate function. For example, instead of SELECT a, b, SUM(c) FROM WINDOW10s GROUP BY a, you should use SELECT a, LAST(b), SUM(c) FROM WINDOW10s GROUP BY a.

function

notes

AVG

Works only with Double and Float. To calculate an average for an Integer or Long field, cast it as Double or Float. For example:

SELECT
AVG(TO_FLOAT(MyWindow.PosData)) AS AvgPosData
FROM MyWindow;

COUNT [DISTINCT]

FIRST

returns Java.lang.Object: see Using FIRST and LAST

LAST

returns Java.lang.Object: see Using FIRST and LAST

LIST(Object,...)

returns a collection of events: see Using pattern matching for an example

MAX

MIN

SUM