我有 2 个问题:
- azure Stream Analytics 是否支持使用 CASE 语句的嵌套条件?
- 我看到这里提到了两种 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
输出:
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
输出:
关于azure - Azure 流分析的嵌套条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53114778/