GREATEST(value1,value2,...) returns the largest (maximum-valued) argument within two or more arguments : GREATEST « Comparison Functions Operators « MySQL Tutorial






mysql>
mysql>
mysql>
mysql> SELECT GREATEST(2,0);
+---------------+
| GREATEST(2,0) |
+---------------+
|             2 |
+---------------+
1 row in set (0.00 sec)

mysql>








15.6.GREATEST
15.6.1.GREATEST(value1,value2,...) returns the largest (maximum-valued) argument within two or more arguments
15.6.2.GREATEST(value1,value2,...) returns NULL if any argument is NULL.
15.6.3.SELECT GREATEST(3.0,3.0,5.0,7.0);
15.6.4.SELECT GREATEST('B','A','C');
15.6.5.Use GREATEST(value1,value2,...) function with column data
15.6.6.GREATEST(@id1, @id2, @id3, @id4, @id5): using Greatest function with user-defined variables