We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path:/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/min-by
+------+------+------+------+ | k1 | k2 | k3 | k4 | +------+------+------+------+ | 0 | 3 | 2 | 100 | | 1 | 2 | 3 | 4 | | 4 | 3 | 2 | 1 | | 3 | 4 | 2 | 1 | +------+------+------+------+
select min_by(k1, k4) from tbl;
+--------------------+ | min_by(k1, k4) | +--------------------+ | 4 | +--------------------+
k1
k4
如何得出最小的k4对应的最小的k1,如上就是得出3?
The text was updated successfully, but these errors were encountered:
正在和社区技术支持同学确认问题,后续如果有疑问可前往 Doris 中文技术论坛 提问,有专人支持解答
Sorry, something went wrong.
min_by的最小值和关联值相关联,如果最小值有多个,那么会返回第一个最小值的关联值,如果这个用法不满足场景,可以通过窗口函数 ROW_NUMBER 来明确排序规则,或者使用 min 函数作为过滤条件查询
No branches or pull requests
Path:/zh-CN/docs/sql-manual/sql-functions/aggregate-functions/min-by
+------+------+------+------+
| k1 | k2 | k3 | k4 |
+------+------+------+------+
| 0 | 3 | 2 | 100 |
| 1 | 2 | 3 | 4 |
| 4 | 3 | 2 | 1 |
| 3 | 4 | 2 | 1 |
+------+------+------+------+
select min_by(k1, k4) from tbl;
+--------------------+
| min_by(
k1
,k4
) |+--------------------+
| 4 |
+--------------------+
如何得出最小的k4对应的最小的k1,如上就是得出3?
The text was updated successfully, but these errors were encountered: