【问题标题】:Kusto KQL equivalent to string_agg in mysqlKusto KQL 相当于 mysql 中的 string_agg
【发布时间】:2020-02-03 11:23:36
【问题描述】:

有没有办法在 Kusto KQL 中连接列?

例如,对于 MySQL (v8) 中具有 name 列的一些 world 数据集:

select group_agg(name) from world;

会导致:

| string_agg                                    |
|-----------------------------------------------|
| Afghanistan,Azerbaijan,Bahrain,Bangladesh,... |

【问题讨论】:

    标签: mysql azure azure-data-explorer kql


    【解决方案1】:

    使用make_set 创建唯一值的动态数组,然后您可以使用strcat_array 获取列表的字符串值。例如:

    StormEvents
    | take 10
    // get array of the distinct values
    | summarize make_set(State) 
    // get a string value of the array
    | extend states = strcat_array(set_State, ", ")
    

    结果:

    【讨论】:

    • 只是补充一点,如果不需要删除重复项,还有一个make_list(可能对这个问题的情况没有用,但我在处理我做过的情况时遇到了这个答案想要提取重复项,以便对未来的访问者有所帮助)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多