gpt4 book ai didi

azure - 如何访问 kusto/Azure 应用程序见解中子查询中的外部列?

转载 作者:行者123 更新时间:2023-12-04 01:43:35 25 4
gpt4 key购买 nike

我尝试使用 Kusto 在 Azure 应用程序见解中简单地运行子查询,以便我可以从显示为一个的两个表中获取一些信息。

我正在尝试的查询是

table1
| extend progressLog = toscalar(
table2
| where common_Id == table1.common_Id // errors saying Ensure that expression: table1.common_Id is indeed a simple name
| summarize makelist(stringColumn)
)

我尝试为该 id 起别名,甚至连接两个表,如下所示:

requests
| extend aliased_id = common_Id
| join traces on operation_Id, $left.operation_Id == $right.operation_Id
| extend test_id = operation_Id
| extend progressLog = toscalar(
traces
| where operation_Id == aliased_id // Failed to resolve column or scalar expression named 'aliased_id'
| summarize makelist(message)
)

无法解析名为“aliased_id”的列或标量表达式。

我只是尝试执行与 T-SQL 查询等效的操作:

SELECT 
... ,
STRING_AGG(table2.stringColumn, ',')
FROM
table1
INNER JOIN
table2
ON table1.common_Id = table2.common_Id
GROUP BY
table.<props>

我的主要问题是 - 如何在子查询中引用 kusto 语言中的“common_Id”

最佳答案

请查看下一个查询是否提供了您要查找的内容。如果没有,请使用数据表共享示例输入(如下所示)和预期输出:

let requests = datatable(common_Id:string, operation_Id:string)
[
"A", "X",
"B", "Y",
"C", "Z"
];
let traces = datatable(operation_Id:string, message:string)
[
"X", "m1",
"X", "m2",
"Y", "m3"
];
let messagesByOperationId = traces | summarize makelist(message) by operation_Id;
requests
| join kind=leftouter messagesByOperationId on operation_Id
| project common_Id, operation_Id, progressLog = list_message

关于azure - 如何访问 kusto/Azure 应用程序见解中子查询中的外部列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56346983/

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