我试过但失败了:
mysql> select max(1,0);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0)' at line 1
最佳答案
使用 GREATEST()
例如:
SELECT GREATEST(2,1);
注意:当任何单个值包含 null 时,此函数总是返回 null(感谢用户 @sanghavi7)
https://stackoverflow.com/questions/1565688/