Aggregate. Returns first value from an ordered set of values. FIRST_VALUE() is an alias for the FIRST() function in the Sybase CEP compiler.
FIRST_VALUE( expression [IGNORE NULLS] )
expression | The expression on which to determine the first value in an ordered set. |
FIRST_VALUE returns the first value in an ordered set of values. If the first value in the set is null, then the function returns NULL unless you specify IGNORE NULLS. If you specify IGNORE NULLS, then FIRST_VALUE returns the first non-null value in the set, or NULL if all values are null. You cannot use FIRST_VALUE or any other analytic function for expression. That is, you cannot nest analytic functions, but you can use other built-in function expressions for expression.
Sybase extension.
INSERT INTO OutOpenCloseMinMax SELECT FIRST(Price) as OpenPrice FROM MyWindow ; INSERT INTO OutOpenCloseMinMax2 SELECT LAST(Price) as OpenPrice, FIRST_VALUE(Price IGNORE NULLS) as OpenPrice2, GETTIMESTAMP(LAST(MyWindow)) as t1 FROM MyWindow