SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
9-7
Sequence Functions
Sequence Functions
Sequence functions operate on ordered rows of the intermediate result table of a
SELECT statement that includes a SEQUENCE BY clause. Sequence functions are
categorized generally as difference, moving, offset, or running.
Difference sequence functions:
DIFF1 Function
on
page 9-59
Calculates differences between values of a column expression
in the current row and previous rows.
DIFF2 Function
on
page 9-62
Calculates differences between values of the result of DIFF1of
the current row and DIFF1 of previous rows.
Moving sequence functions:
MOVINGAVG Function
on
page 9-109
Returns the average of non-null values of a column expression
in the current window.
MOVINGCOUNT
Function on page 9-111
Returns the number of non-null values of a column expression
in the current window.
MOVINGMAX Function
on page 9-113
Returns the maximum of non-null values of a column
expression in the current window.
MOVINGMIN Function
on
page 9-115
Returns the minimum of non-null values of a column expression
in the current window.
MOVINGSTDDEV
Function on page 9-117
Returns the standard deviation of non-null values of a column
expression in the current window.
MOVINGSUM Function
on page 9-119
Returns the sum of non-null values of a column expression in
the current window.
MOVINGVARIANCE
Function on page 9-121
Returns the variance of non-null values of a column expression
in the current window.
Offset sequence function:
OFFSET Function
on
page 9-128
Retrieves columns from previous rows.
Running sequence functions:
RUNNINGAVG Function
on page 9-153
Returns the average of non-null values of a column expression
up to and including the current row.
RUNNINGCOUNT
Function on page 9-155
Returns the number of rows up to and including the current row.
RUNNINGMAX Function
on page 9-157
Returns the maximum of values of a column expression up to
and including the current row.
RUNNINGMIN Function
on page 9-159
Returns the minimum of values of a column expression up to
and including the current row.
RUNNINGSTDDEV
Function on page 9-161
Returns the standard deviation of non-null values of a column
expression up to and including the current row.