Upsolver
Search…
MIN
The minimum value in the time window.

Syntax

MIN(VALUE)

Arguments

VALUE: An expression of any type (INTEGER/STRING/DATE) that can be ordered. ‌

Returns

The result type matches the type of the argument.

Example

Data

1
[
2
{
3
"user":"A01",
4
"level":1,
5
"score":25
6
},
7
{
8
"user":"A01",
9
"level":2,
10
"score":48
11
},
12
{
13
"user":"A01",
14
"level":2,
15
"score":81
16
},
17
{
18
"user":"B02",
19
"level":1,
20
"score":23
21
},
22
{
23
"user":"B02",
24
"level":1,
25
"score":29
26
}
27
]
Copied!

Query

Find the lowest score of each user/level:
1
SELECT
2
data.level AS level:DOUBLE,
3
data.user AS user:STRING,
4
MIN(data.score) AS min_data_score:BIGINT
5
FROM
6
"MAX_SAMPLE_DATA - json"
7
GROUP BY
8
data.level,
9
data.use
Copied!

Results

1
{
2
"min_data_score":48,
3
"level":2,
4
"user":"A01"
5
}{
6
"min_data_score":23,
7
"level":1,
8
"user":"B02"
9
}{
10
"min_data_score":25,
11
"level":1,
12
"user":"A01"
13
}
Copied!

Dialog