Syntax
GREATEST(value1, ...)
Purpose
Returns the maximum value among the parameters, which is the opposite of the LEAST() function.
At least two parameters are required (an error is returned if only one parameter is provided). If any parameter is NULL, the function returns NULL.
When both numeric and character parameters are provided, the character parameters are implicitly converted to numeric types. If the conversion fails, an error is returned.
Examples
obclient> SELECT GREATEST(2,1), GREATEST('2',1,0), GREATEST('a','b','c'), GREATEST('a', NULL, 'c'), GREATEST('2014-05-15','2014-06-01')\G
*************************** 1. row ***************************
GREATEST(2,1): 2
GREATEST('2',1,0): 2
GREATEST('a','b','c'): c
GREATEST('a', NULL, 'c'): NULL
GREATEST('2014-05-15','2014-06-01'): 2014-06-01
1 row in set
obclient> SELECT GREATEST(2);
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'greatest'
