Home >Database >Mysql Tutorial >mysql GREATEST()函数获取集合中最大的值

mysql GREATEST()函数获取集合中最大的值

WBOY
WBOYOriginal
2016-06-01 09:56:571768browse

GREATEST(n1,n2,n3,..........)

GREATEST()函数返回输入参数(n1, n2, n3, 等)组的最大值。下面的示例使用 GREATEST()函数从一组数字值中返回最大的值:

<code class="language-sql">mysql>SELECT GREATEST(3,5,1,8,33,99,34,55,67,43);
+---------------------------------------------------------+
| GREATEST(3,5,1,8,33,99,34,55,67,43)                     |
+---------------------------------------------------------+
| 99                                                      |
+---------------------------------------------------------+
1 row in set (0.00 sec)</code>

住:GREATEST()函数是LEAST()函数的相反函数。 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn