Name
GREATEST()
Synopsis
GREATEST(value
,value
, ...)
This function compares two or more values, returning the
greatest value. In an INTEGER
data type context,
all values are treated as integers for comparison. In a
REAL
data type context, all values are treated as
REAL
values for comparison. If any parameter
contains a case-sensitive string
(i.e., with a BINARY
keyword), all values are
compared as case-sensitive strings. Here is an example:
SELECT GREATEST(col1, col2, col3);
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.