1

I have 2 questions:

  1. Does azure Stream analytics support nested conditions using the CASE statement ?
  2. I see there are 2 formats of CASE expression mentioned here- https://learn.microsoft.com/en-us/stream-analytics-query/case-azure-stream-analytics . I found examples for searched CASE here. Can anyone give example for the Simple CASE expression?
Rima
  • 545
  • 6
  • 12

1 Answers1

3

Sample data :

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

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

Based on my test, it supports nested case conditions.

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

Output:

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

Output:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Jay Gong
  • 23,163
  • 2
  • 27
  • 32