A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: Aggregate Functions

max()

The aggregate function max() determines the highest value in a column of a table.

Syntax of the Aggregate Function max()

    max( expression )
    

The parameters of the Aggregate Function max()

expression
The parameter "expression" of the function max() is a placeholder for a column name. It is also possible to declare several column names, a subquery and constants.

Usage of the Aggregate Function max()

The function max() can be used to query columns which have been defined with numeric datatypes and datetime datatypes. It cannot be used for queries on bit columns. When querying columns defined with character datatypes, max() will find the highest value according to the specified sort order, also called collating sequence.

The function max() ignores NULL values. In addition, max() automatically converts the datatypes char to varchar and unichar to univarchar and removes all blanks at the end of a string.

Example for the Aggregate Function max()

Returns the highest value in the column "column_name" of the table "table_name".

    select max(column_name) from table_name
    

See also:

ASE T-SQL - Aggregate Functions,
avg(),
count(*),
count(),
count_big(),
min(),
sum().