MAX

函数说明

MAX()是聚合函数的一种,计算了一组值的最大值。

函数语法

  1. > MAX(expr)

参数释义

参数说明
expr任何数值类型与字符串列的列名

返回值

返回expr列中的最大值,同时也可以在MAX()中使用字符串,如此会返回最大的字符串值。

示例

  1. > drop table if exists tbl1,tbl2;
  2. > create table tbl1 (col_1a tinyint, col_1b smallint, col_1c int, col_1d bigint, col_1e char(10) not null);
  3. > insert into tbl1 values (0,1,1,7,"a");
  4. > insert into tbl1 values (0,1,2,8,"b");
  5. > insert into tbl1 values (0,1,3,9,"c");
  6. > insert into tbl1 values (0,1,4,10,"D");
  7. > insert into tbl1 values (0,1,5,11,"a");
  8. > insert into tbl1 values (0,1,6,12,"c");
  9. > select max(col_1d) from tbl1;
  10. +-------------+
  11. | max(col_1d) |
  12. +-------------+
  13. | 12 |
  14. +-------------+
  15. > select max(col_1c) as m1 from tbl1 where col_1d<12 group by col_1e;
  16. +------+
  17. | m1 |
  18. +------+
  19. | 5 |
  20. | 2 |
  21. | 3 |
  22. | 4 |
  23. +------+

限制

MatrixOne目前只支持在查询表的时候使用函数,不支持单独使用函数。