max

Return the maximum value in each aggregate

Syntax

max(value_expr)

Arguments

value_expr The expression for which the maximum value is to be returned.

Description

This function returns the maximum value of expression over all the rows of each aggregate.

Example

open nsfawards;

select orgid, min(amount), max(amount) from nsforg natural join award
    where amount > 1 
    group by 1 having count(*) > 5000;

orgid       min(amount)       max(amount)
CHE                2200          24999479
DMI                1686          10870000
DMR                2000          87716900
DMS                 200          17750000
DUE                 961          13217804
EAR                 235          84999999
IBN                  91          11914983
INT                 285          30420573
OCE                 473         300937389
SES                  76          14797014