Export (0) Print
Expand All
Expand Minimize

MAX (SQL Server Compact)

Returns the maximum value in the expression.


MAX ([ ALL ] expression )

ALL

Applies the aggregate function to all values. ALL is the default.

expression

A constant, column name, or function, and any combination of arithmetic, bitwise, and string operators. MAX can be used with numeric, character, and datetime columns, but not with bit columns. Aggregate functions and subqueries are not permitted.

Returns a value of the same type as expression.

MAX ignores any null values.

For character columns, MAX finds the highest value in the collating sequence.

The following example uses MAX to determine the highest priced item in the Products table.

SELECT MAX(UnitPrice)AS "Most Expensive" FROM Products

This is the result set:

Most Expensive
--------------
263.5
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft