语法:

GREATEST(value1,value2,...)

说明:

在有两个或更多参数中,返回那个最大的。参数之间的比较规则和函数LEAST()一致。

例子:

MariaDB [(none)]> SELECT GREATEST(2,0);
+---------------+
| GREATEST(2,0) |
+---------------+
|             2 |
+---------------+
1 row in set (0.00 sec)

MariaDB [(none)]> 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)

MariaDB [(none)]> SELECT GREATEST('B','A','C');
+-----------------------+
| GREATEST('B','A','C') |
+-----------------------+
| C                     |
+-----------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> 

Comments

Comments loading...