Kusto 按计数排序

Kusto Sort by aggregate like Count

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

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

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

exceptions
| summarize count() by type

我不知道如何按聚合排序。我试过 | sort by count() desc| sort by count() by type desc| as c | sort by c desc| extend c = summarize count() by type | sort by c desc

count() 聚合的默认列名称是 count_,因此:

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

或者,明确命名列:

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