WITH (Azure Stream Analytics)
Updated: May 2, 2016
Applies To: Azure
Specifies a temporary named result set which can be referenced by a FROM clause in the query. This is defined within the execution scope of a single SELECT statement.
|
Syntax
WITH <result_set_name1> AS ( SELECT_query_definition1 ), [<result_set_name2> AS ( SELECT_query_definition2 ) [...n] ]
result_set_name
This is the name of the temporary result-set which can be referenced by a FROM clause of a SELECT statement. This name must be different from the name of any other result_set_name defined within the scope of the query.
SELECT_query_definition
Specifies a SELECT statement whose result set populates the result_set_name.
WITH NormalReadings AS ( SELECT * FROM Sensor WHERE Reading < 100 AND Reading > 0 ), Averages AS ( SELECT SensorId, AVG(Reading) as AvgNormalReading FROM NormalReadings GROUP BY SensorId, TumblingWindow(minute, 1) ), BadAverages AS ( SELECT * FROM Averages WHERE AvgNormalReadings < 10 ) SELECT * INTO outputAlerts FROM BadAverages SELECT * INTO outputLog FROM NormalReadings
Show: