Avg (open)

Aggregate function which returns the average of values

Syntax

// Core function, no LOADLIB necessary

VARIANT FUNCTION Avg(VARIANT data)

Parameters

VARIANT data

Array of expressions

Return value

VARIANT

Returns the average of expressions

Description

Avg is an aggregate function which can be used in SELECT statements, and which returns the average of expressions. Avg can only be used within a SELECT statement, and specifically only in the HAVING, ORDER BY clauses and in the list of selected cells.

Examples

// Show per car maker the average cost of their models
  SELECT maker, Avg(price)
    FROM car_types
GROUP BY maker