max
计算一组值中的最大值的聚合函数。
示例
SELECT max(salary) FROM employees;
SELECT department, max(salary) FROM employees GROUP BY department;
如果您需要非聚合函数来选择两个值中的最大值,请参见 greatest
SELECT greatest(a, b) FROM table;
计算一组值中的最大值的聚合函数。
示例
SELECT max(salary) FROM employees;
SELECT department, max(salary) FROM employees GROUP BY department;
如果您需要非聚合函数来选择两个值中的最大值,请参见 greatest
SELECT greatest(a, b) FROM table;