【问题标题】:Nested condition for Azure Stream analyticsAzure 流分析的嵌套条件
【发布时间】:2018-11-02 08:05:37
【问题描述】:
【问题讨论】:
标签:
azure
azure-stream-analytics
stream-analytics
【解决方案1】:
样本数据:
[{
"id": "0001",
"type": "donut",
"name": "Cake"
},
{
"id": "0002",
"type": "donut2",
"name": "Cake2"
]
Azure 流分析是否支持使用 CASE 的嵌套条件
声明?
根据我的测试,它支持嵌套的 case 条件。
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
输出:
谁能举个简单 CASE 表达式的例子?
SQL:
select jsoninput.id as id, jsoninput.type as type ,
case jsoninput.id when '0001' then 'true' else 'false' end as res
from jsoninput
输出: