max(X) The max() aggregate function returns the maximum value of all values in the group. The maximum value is the value that would be returned last in an ORDER BY on the same column. Aggregate max() returns NULL if and only if there are no non-NULL values in the group. http://www.sqlite.org/lang_aggfunc.html#maxggunc