位置:首頁 > 數據庫 > MySQL教學 > MySQL greatest()函數

MySQL greatest()函數

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

GREATEST()函數返回輸入參數(n1, n2, n3, 等)組的最大值。下麵的示例使用 GREATEST()函數從一組數字值中返回最大的值:

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)