Updated on 2024-09-19 GMT+08:00

Reduction Functions

Description

Reduction functions operate on zero or a list of expressions and return a single expression. If no expression is passed as a parameter, the result is NULL. All expressions must be converted to public data types.

  • If all parameters are NULL, the result is NULL. Otherwise, NULL parameters are ignored.
  • If all parameters contain both numbers and strings, they are interpreted as strings.
  • If all parameters are integers, they are interpreted as long integers.
  • If all parameters are numeric and at least one of them is double, all parameters are interpreted as double.

Syntax

GREATEST([expr1, ...])/ LEAST([expr1, ...])

Examples

GREATEST([expr1, ...])/LEAST([expr1, ...])

The GREATEST function returns the maximum value in zero or a list of expressions.

The LEAST function returns the minimum value in zero or a list of expressions.

  1. Example field

    Num: 11785730

  2. Query and analysis statement
    select  Num,GREATEST( "Num"/10,(select count(1)) ),LEAST("Num"/10,(select count(1)))
  3. Query and analysis result
    Table 1 Query and analysis result of reduction functions

    Num

    EXPR$1

    EXPR$2

    11785730

    1178573

    1