如何在 Kusto 数据库的连接条件中将列转换为小写
How to convert the columns to lowercase in join condition in Kusto Database
TableA
| where GuidId == "123"
| where Desc has_any ("processor")
| join kind=leftouter TableB on
$left.SubId == $right.SubId,
$left.ProductName == $right.Name,
$left.GuidId == $right.GuidId
| distinct SubId, PriceTags, ResourceType, ProductName, Name
ProductName为小写,Name为驼峰式。如何在 Join 条件下将 ProductName 和 Name 带到同一个 case。
谢谢
类似于:
|扩展 Name=tolower(Name)
TableA
| where GuidId == "123"
| where Desc has_any ("processor")
| join kind=leftouter (TableB | extend Name=tolower(Name)) on $left.SubId == $right.SubId, $left.ProductName==$right.Name, $left.GuidId==$right.GuidId
|distinct SubId, PriceTags, ResourceType, ProductName, Name
扩展 Name=tolower(Name)
您需要 'normalize' join
之前的值。
- 理想情况下,您将在摄取之前或摄取时(使用更新策略)执行此操作。
- 鉴于当前的非规范化值,您可以在查询时执行此操作(性能将不是最佳的):
TableA
| where GuidId == "123"
| where Desc has "processor"
| join kind=leftouter (
TableB
| extend Name = tolower(Name)
) on
$left.SubId == $right.SubId,
$left.ProductName == $right.Name,
$left.GuidId == $right.GuidId
| distinct SubId, PriceTags, ResourceType, ProductName, Name
TableA
| where GuidId == "123"
| where Desc has_any ("processor")
| join kind=leftouter TableB on
$left.SubId == $right.SubId,
$left.ProductName == $right.Name,
$left.GuidId == $right.GuidId
| distinct SubId, PriceTags, ResourceType, ProductName, Name
ProductName为小写,Name为驼峰式。如何在 Join 条件下将 ProductName 和 Name 带到同一个 case。
谢谢
类似于:
|扩展 Name=tolower(Name)
TableA
| where GuidId == "123"
| where Desc has_any ("processor")
| join kind=leftouter (TableB | extend Name=tolower(Name)) on $left.SubId == $right.SubId, $left.ProductName==$right.Name, $left.GuidId==$right.GuidId
|distinct SubId, PriceTags, ResourceType, ProductName, Name
扩展 Name=tolower(Name)
您需要 'normalize' join
之前的值。
- 理想情况下,您将在摄取之前或摄取时(使用更新策略)执行此操作。
- 鉴于当前的非规范化值,您可以在查询时执行此操作(性能将不是最佳的):
TableA
| where GuidId == "123"
| where Desc has "processor"
| join kind=leftouter (
TableB
| extend Name = tolower(Name)
) on
$left.SubId == $right.SubId,
$left.ProductName == $right.Name,
$left.GuidId == $right.GuidId
| distinct SubId, PriceTags, ResourceType, ProductName, Name