MAX()
MAX returns the maximum of all values of the specified expression in a group.
Signature
MAX ( [ ALL | DISTINCT ] expression )Parameters
- expression — A constant, column name, or function, and any combination of arithmetic, bitwise, and string operators. `MAX` can be used with numeric, char, nchar, varchar, nvarchar, uniqueidentifier, or datetime columns, but not with bit columns. Aggregate functions and subqueries aren't permitted.
Examples
SELECT MAX(amount) AS dearest FROM dbo.orders;dearest
------------
438.00SELECT MAX(name)
FROM sys.databases
WHERE database_id < 5;tempdbRun against SQL Server 16.0.4265.3 on 2026-09-13. This is the output we got, not the documentation’s.
Available on
- SQL Server 2017 and later
- Azure SQL Database
- Azure SQL Managed Instance
- Azure Synapse Analytics
- Analytics Platform System (PDW)
- Microsoft Fabric warehouse
- Fabric SQL database
Signature and description adapted from the Microsoft SQL documentation, used under the CC BY 4.0. SQL Server and Azure are trademarks of the Microsoft group of companies. This page is not affiliated with Microsoft.