【问题标题】:Kusto Query to the earliest timestamp grouped by user_IdKusto 查询到按 user_Id 分组的最早时间戳
【发布时间】:2021-01-13 12:05:03
【问题描述】:

我刚从 kusto 开始,我的旅程突然停止,因为获取 user_Ids 列表以及用户在给定时间范围内发送的第一个 customEvent 的时间戳的问题。

我应该如何修改我的查询以获得结果(假设限制时间跨度为 30 天)

customEvents 
| where timestamp >= ago(30d)
| summarize min(timestamp)

【问题讨论】:

    标签: azure azure-data-explorer kql appinsights


    【解决方案1】:

    如果您只想获取时间戳的最小值,只需添加“by”子句:

    customEvents 
    | where timestamp >= ago(30d)
    | summarize min(timestamp) by user_Id
    

    如果要获取整行,请使用 arg_min() 函数,例如:

    customEvents 
    | where timestamp >= ago(30d)
    | summarize arg_min(timestamp, *) by user_Id
    

    【讨论】:

    • 哦,arg_min 是邪恶的,谢谢!为了将来参考,最好将 UserId 更改为 user_Id - 然后两个查询都可以运行。再次感谢!
    猜你喜欢
    • 2020-08-28
    • 2015-02-12
    • 2013-08-07
    • 2020-10-29
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多