OLAP functions provide the capability to perform analytic tasks on data, such as computing moving averages, ranks, and cumulative values. You can include an OLAP function in a select-list or on the ORDER BY clause of a SELECT statement. An OLAP function cannot be used as an argument of an aggregate function. Therefore, you cannot have functions like SUM( RANK() ).
When using an OLAP function, a window is specified that defines the rows over which the function is applied, and in what order. The set of rows is defined, relative to the current row, as either a range or a number of rows preceding and following. For example, you can calculate an average over the previous three month period.
The following OLAP functions are available:
Rank functions Let you compile a list of values from your data set in ranked order. For example, listing the sales representatives in decreasing order of total sales for each quarter.
Reporting functions Let you compare a non-aggregate value to an aggregate value. For example, listing all quarters in which expenses are less than the average.
Window functions Let you analyze your data by defining a moving window for it. For example, calculating a moving average, such as the NASDAQ figure, over a 30-day period.
Rank functions
Reporting functions
Window functions
SQL Anywhere Studio 9.0.2
Copyright © 1989–2004 Sybase, Inc. Portions copyright © 2001–2004 iAnywhere Solutions, Inc. All rights reserved.