Neoview SQL Reference Manual (R2.4 SP2)
ROWS SINCE CHANGED Function
The ROWS SINCE CHANGED function is a sequence function that returns the number of rows
counted since the specified set of values last changed in the intermediate result table ordered by
a SEQUENCE BY clause in a SELECT statement. See “SEQUENCE BY Clause” (page 314).
ROWS SINCE CHANGED is a Neoview SQL extension.
ROWS SINCE CHANGED (column-expression-list)
column-expression-list
is a comma-separated list that specifies a derived column list determined by the evaluation
of the column expression list. ROWS SINCE CHANGED returns the number of rows counted
since the values of column-expression-list changed.
Considerations for ROWS SINCE CHANGED
Counting the Rows
For the first row in the intermediate result table, the count is 1. For subsequent rows that have
the same value for column-expression-list as the previous row, the count is 1 plus the
count in the previous row. For subsequent rows that have a different value of
column-expression-list than the previous row, the count is 1.
Examples of ROWS SINCE CHANGED
• Return the number of rows since the value I1 last changed:
SELECT ROWS SINCE CHANGED (I1)
FROM mining.seqfcn
SEQUENCE BY TS;
• Return the number of rows since the values I1 and ts last changed:
SELECT ROWS SINCE CHANGED (I1, TS)
FROM mining.seqfcn
SEQUENCE BY TS;
ROWS SINCE CHANGED Function 441