mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 12:32:04 +00:00
915 B
915 B
slug | sidebar_position |
---|---|
/zh/sql-reference/aggregate-functions/reference/argmin | 105 |
argMin
语法: argMin(arg, val)
或 argMin(tuple(arg, val))
计算 val
最小值对应的 arg
值。
示例:
输入表:
┌─user─────┬─salary─┐
│ director │ 5000 │
│ manager │ 3000 │
│ worker │ 1000 │
└──────────┴────────┘
查询:
SELECT argMin(user, salary), argMin(tuple(user, salary), salary) FROM salary;
结果:
┌─argMin(user, salary)─┬─argMin(tuple(user, salary), salary)─┐
│ worker │ ('worker',1000) │
└──────────────────────┴─────────────────────────────────────┘