gpt4 book ai didi

sorting - Kusto 按计数排序

转载 作者:行者123 更新时间:2023-12-02 16:02:19 28 4
gpt4 key购买 nike

我是 Kusto/KQL 的新手,但在 T-SQL 方面经验丰富。我正在尝试获取异常列表,按类型对它们进行分组,添加一个计数,然后按该计数降序排列。在 SQL 中它将是:

SELECT Type, COUNT(Type)
FROM exceptions
GROUP BY Type
ORDER BY COUNT(Type) Desc

除了排序,我什么都搞定了。

exceptions
| summarize count() by type

我不知道如何按聚合排序。我试过 |按 count() desc, | 排序按类型 desc 按 count() 排序, |作为 c |按 c desc, | 排序扩展 c = 按类型汇总 count() |按 c desc 排序

最佳答案

count() 聚合的默认列名是count_,所以:

exceptions
| summarize count() by type
| sort by count_ desc

或者,明确命名该列:

exceptions
| summarize CountExceptions = count() by type
| sort by CountExceptions desc

关于sorting - Kusto 按计数排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70361954/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com