Aggregate Operator

The Aggregate operator condenses a multi-row result set into a single-row result set by applying any of a number of functions to the data.

Aggregate functions perform calculations such as totalling or counting the values for each row. An Aggregate operator’s output row has one column containing the result of each function defined. The functions are commonly used to operate on the contents of a single column from the input result set, but the parameter passed to them can actually be the result of an arbitrary JavaScript expression, allowing more complex calculations. The functions that WorkSpace Data Federation supports for aggregation are Sum, Average, Maximum, Minimum, Count, First, Last, Population Variance, Sample Variance, Population Standard Deviation, and Sample Standard Deviation.

For example, if you have a result set with a column called SALARY containing each employee’s salary, you can define a new column using an Aggregate operator that calculates the total salary for all rows in the result set using the Sum function and passing the value SALARY as the corresponding expression.

Note that the original columns from the input result set are not carried through to the output of the Aggregate operator, only the newly computed ones.

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.