Considerations For Runningavg; Equivalent Result; Example Of Runningavg; Runningcount Function - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

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
--------------------
--- 5 row(s) selected.

RUNNINGCOUNT Function

The RUNNINGCOUNT function is a sequence function that returns the number of rows up to
and including the current row of an intermediate result table ordered by a SEQUENCE BY clause
in a SELECT statement. See
RUNNINGCOUNT is a Neoview SQL extension.
RUNNINGCOUNT {(*) | (column-expression)}
*
as an argument causes RUNNINGCOUNT(*) to return the number of rows in the intermediate
result table up to and including the current row.
column-expression
specifies a derived column determined by the evaluation of the column expression. If
column-expression is the argument, RUNNINGCOUNT returns the number of rows
containing nonnull values of column-expression in the intermediate result table up to
and including the current row.

Considerations for RUNNINGCOUNT

No DISTINCT Clause

The RUNNINGCOUNT sequence function is defined differently from the COUNT aggregate
function. If you specify DISTINCT for the COUNT aggregate function, duplicate values are
eliminated before COUNT is applied. Note that you cannot specify DISTINCT for the
RUNNINGCOUNT sequence function; duplicate values are counted.

Example of RUNNINGCOUNT

Return the number of rows that include nonnull values of I1 up to and including the current row
:
SELECT RUNNINGCOUNT (I1) AS COUNT_I1
FROM mining.seqfcn
396
SQL Functions and Expressions
6215
17194
11463
9746
10190
"SEQUENCE BY Clause" (page
268).

Advertisement

Table of Contents
loading

Table of Contents