文档中心

关于 SequoiaDB

快速入门

安装

基本操作

数据模型

SQL引擎

S3引擎

系统架构

数据库管理

连接器

驱动

参考手册

故障排除

SAC 管控中心

Web服务

版本信息

max()

聚集函数

用于返回记录中,指定字段名的最大值。

语法

max(<field_name>) as <alias_name>

参数

参数名 参数类型 描述 是否必填
field_name string 字段名。
alias_name string 别名。

Note:

  • 使用 max 函数返回字段的最大值时,必须使用别名。

返回值

指定字段在记录中的最大值。

示例

  • 集合 foo.bar 中原始记录。

    {a:0, b:2}
    {a:1, b:2}
    {a:2, b:3}
    {a:3, b:3}
  • 返回集合 foo.bar 中 a 字段的最大值。

    > db.exec("select max(a) as 最大值 from foo.bar")
    { "最大值": 3 }
    Return 1 row(s).
    Takes 0.5155s.
回到顶部