Hi Bala,
#1: This is not going to reset START_TIME when the first row evaluates to true. It's simply creating a new partition *after* the first row evaluates to true. This would require a kind of recursive approach, that's why there's recursion :-)
#2: You should already know how ROWS works when you try to write queries based on that ;-)
Logically it's similar to a Correclated Subquery:
For each row within the answer set the aggregate will be recalculated based on all rows
between a starting row and an ending row.
Starting and ending row might be fixed or relative to the current row based on the following
keywords:
UNBOUNDED PRECEDING, all rows before the current row -> fixed
UNBOUNDED FOLLOWING, all rows after the current row -> fixed
x PRECEDING, x rows before the current row -> relative
y FOLLOWING, y rows after the current row -> relative
Check the Functions & Operator manual for more details.
Dieter
↧