Azure 流分析的嵌套条件
Nested condition for Azure Stream analytics
我有两个问题:
- Azure Stream 分析是否支持使用 CASE 语句的嵌套条件?
- 我看到这里提到了 2 种格式的 CASE 表达式 - https://docs.microsoft.com/en-us/stream-analytics-query/case-azure-stream-analytics . I found examples for searched CASE 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 Stream 分析是否支持使用 CASE 语句的嵌套条件?
- 我看到这里提到了 2 种格式的 CASE 表达式 - https://docs.microsoft.com/en-us/stream-analytics-query/case-azure-stream-analytics . I found examples for searched CASE 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
输出: