日期:2014-05-16  浏览次数:21094 次

mysql求最大值问题??急
有几个不相关的值,我想找出最大值。类似于max(a,b,c),能够找出最大值。mysql里面有没有这样的函数??
或者怎么实现这样的功能???

------解决方案--------------------
select GREATEST(123,456,789) 

GREATEST(value1,value2,...) 

With two or more arguments, returns the largest (maximum-valued) argument. The arguments are compared using the same rules as for LEAST(). 

mysql> SELECT GREATEST(2,0);
-> 2
mysql> SELECT GREATEST(34.0,3.0,5.0,767.0);
-> 767.0
mysql> SELECT GREATEST('B','A','C');
-> 'C'

GREATEST() returns NULL if any argument is NULL.