Can I have multiple queries in the same output in Azure Stream Analytics Job?
For example
SELECT property1, property2 INTO Output1 WHERE Property3 ='Answer'
SELECT property4, property5 INTO Output1 WHERE Property3 ='Question'
Can I have multiple queries in the same output in Azure Stream Analytics Job?
For example
SELECT property1, property2 INTO Output1 WHERE Property3 ='Answer'
SELECT property4, property5 INTO Output1 WHERE Property3 ='Question'
Union the results first and alias the combo using WITH, then Select from that table into the output.
https://msdn.microsoft.com/en-us/azure/stream-analytics/reference/union-azure-stream-analytics
Didn't test this, but should give the idea:
WITH Combined AS (
SELECT property1, property2
FROM [input-hub]
WHERE Property3 ='Answer'
UNION
SELECT property4, property5
FROM [input-hub]
WHERE Property3 ='Question'
)
SELECT *
INTO [output-cosmos]
FROM Combined
Another method is to add the same output under two different ASA Alias for defined Output Sinks. For example: 1 output, MyBlob can be reference in ASA as 2 Alias, OutPut1 and OutPut2.
Benefits to this method are to allow control of the path that the data is output to. While it may go to the same output sink, it can be configured to output to a different path or container.
No, I just tried and it fires this error while starting the job
Stream Analytics job has validation errors: Query compilation error: Duplicate output names are not allowed 'output-cosmos'.
I used the following query
SELECT deviceId, pgm
INTO [output-cosmos]
FROM [input-hub]
WHERE pgm.running = true
SELECT deviceId, pgm
INTO [output-cosmos]
FROM [input-hub]
WHERE pgm.running = true