As indicated in the diagrams for Aggregate Expressions and User-Defined Aggregates (IDS), not all expressions are available when you use an aggregate expression. The argument of an aggregate function, for example, cannot itself contain an aggregate function. You cannot use aggregate functions in the following contexts:
The following nested aggregate expression is invalid:
MAX (AVG (order_num))
You cannot use a column that is a collection data type as an argument to the following aggregate functions:
Expression or column arguments to built-in aggregates (except for COUNT, MAX, MIN, and RANGE) must return numeric or INTERVAL data types, but RANGE also accepts DATE and DATETIME arguments.
For SUM and AVG, you cannot use the difference between two DATE values directly as the argument to an aggregate, but you can use DATE differences as operands within arithmetic expression arguments. For example:
SELECT . . . AVG(ship_date - order_date)
returns error -1201, but the following equivalent expression is valid:
SELECT . . . AVG((ship_date - order_date)*1)Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]