azure - Azure 流分析的嵌套条件

标签 azure azure-stream-analytics stream-analytics

我有 2 个问题:

  1. azure Stream Analytics 是否支持使用 CASE 语句的嵌套条件?
  2. 我看到这里提到了两种 CASE 表达式格式 - https://learn.microsoft.com/en-us/stream-analytics-query/case-azure-stream-analytics 。我找到了搜索案例 here 的示例。谁能举出简单 CASE 表达式的例子吗?

最佳答案

示例数据:

[{
"id": "0001",
"type": "donut",
"name": "Cake"
},
{
"id": "0002",
"type": "donut2",
"name": "Cake2"
]

Does azure Stream analytics support nested conditions using the CASE statement ?

根据我的测试,它支持嵌套的情况条件。

SQL:

select jsoninput.id as id, jsoninput.type as type ,
case when 
    ((case when  jsoninput.id = '0001' then '0' else '1' end) = '0' ) then '0'
else  '1' end as res
from jsoninput

输出:

enter image description here

Can anyone give example for the Simple CASE expression?

SQL:

select jsoninput.id as id, jsoninput.type as type ,
case jsoninput.id when '0001' then 'true' else 'false' end as res 
from jsoninput

输出:

enter image description here

关于azure - Azure 流分析的嵌套条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53114778/

相关文章:

azure - Azure 前门是否适用于特定范围的 IP 地址?

azure - 如何在 Cosmos DB 中查找重复文档

azure - 使用流分析将数据从 IoT 中心传输到 Cosmos DB 会出现分区错误

python - Azure 表存储 Python SDK,语法无效

azure - 如何添加 Azure 应用程序网关后端池的路径?

Azure DocumentDb 一致性级别建议

azure - 来自 Azure IOT 中心的 SMS 消息传递

azure - Azure 中运行的流分析查询中的语法问题 : Invalid column name: 'payload'

azure - Azure 流分析 SAQL 中满足条件时的默认字段值