ODBC Server Reference Manual
Transact-SQL Language
HP NonStop ODBC Server Reference Manual—429151-002
4-32
Aggregates
AVG returns a floating point value that represents the average of the values in the
column identified by expression; null values are ignored. If you include DISTINCT,
AVG eliminates duplicate values before calculating the average. AVG can be used with
numeric columns only.
If you include DISTINCT when executing AVG using the NonStop ODBC Server,
expression cannot be a constant. (The expression can be a constant when using
Transact-SQL.)
COUNT
The COUNT aggregate function has the following syntax:
COUNT returns a floating-point value that represents the number of nonnull values in
the column identified by column-name. If you include DISTINCT, COUNT eliminates
duplicate values before making the count.
If only column-name is specified, the column data type must be a numeric data type
such as NUMERIC and not a nonnumeric type such as CHAR.
If you use * instead of column-name, COUNT returns the number of rows, regardless
of the presence of null values; * and DISTINCT cannot be used together.
If you omit the DISTINCT keyword when using the NonStop ODBC Server, the default
is DISTINCT. If you omit DISTINCT when executing COUNT using SQL Server,
however, all rows are counted.
If you include DISTINCT when using the NonStop ODBC Server, column-name
cannot be a constant. (The column-name can be a constant when using
Transact-SQL.)
(NonStop SQL/MP does not support the COUNT function when only column-name is
specified in a query; however, NonStop ODBC has implemented the COUNT function
for ODBC clients that need this function.)
MAX
The MAX aggregate function has the following syntax:
MAX returns the maximum value in the column identified by expression. MAX can
be used with numeric, character, and date columns, but not with bit columns. With
character columns, MAX returns the value that is highest in the collating sequence.
MAX ignores null values.
COUNT ( { DISTINCT column-name } )
{ column-name }
{ * }
MAX ( expression )