mysql.h
GREATEST
GREATEST(X,Y,...)
Devuelve el argumento mayor. Los argumentos son comparados usando las mismas reglas que para LEAST().
mysql> SELECT GREATEST(2,0); +---------------+ | GREATEST(2,0) | +---------------+ | 2 | +---------------+ 1 row in set (0.00 sec) mysql> SELECT GREATEST(34.0,3.0,5.0,767.0); +------------------------------+ | GREATEST(34.0,3.0,5.0,767.0) | +------------------------------+ | 767.0 | +------------------------------+ 1 row in set (0.00 sec) mysql> SELECT GREATEST("B","A","C"); +-----------------------+ | GREATEST("B","A","C") | +-----------------------+ | C | +-----------------------+ 1 row in set (0.00 sec)
En versiones de MySQL anteriores a 3.22.5, se puede usar MAX() en lugar de GREATEST.