Neoview SQL Reference Manual (R2.4 SP2)

RUNNINGAVG Function
The RUNNINGAVG function is a sequence function that returns the average of nonnull values
of a column up to and including the current row of an intermediate result table ordered by a
SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 314).
RUNNINGAVG is a Neoview SQL extension.
RUNNINGAVG (column-expression)
column-expression
specifies a derived column determined by the evaluation of the column expression.
RUNNINGAVG returns the average of nonnull values of column-expression up to and
including the current row.
Considerations for RUNNINGAVG
Equivalent Result
The result of RUNNINGAVG is equivalent to:
RUNNINGSUM(column-expr) / RUNNINGCOUNT(*)
Example of RUNNINGAVG
Return the average of nonnull values of I1 up to and including the current row:
SELECT RUNNINGAVG (I1) AS AVG_I1
FROM mining.seqfcn
SEQUENCE BY TS;
AVG_I1
--------------------
6215
17194
11463
9746
10190
--- 5 row(s) selected.
444 SQL Functions and Expressions