Aditi Mittal
Aditi Mittal

Reputation: 11

Stream Analytics

Is it possible to include more than one input source in stream analytics? I want to output different columns into the same output , however, it does not allow me to use the same output name.

This is the query I wrote: with pg1 as( SELECT count(),id FROM EventHub where id='1' group by id,TumblingWindow(hour,1) ), pg2 as( SELECT count() ,id FROM EventHub where id='2' group by id, TumblingWindow(hour,1) ) Select count() into PowerBiAlias from pg1 group by TumblingWindow(hour,1) Select count() into PowerBiAlias from pg2 group by TumblingWindow(hour,1)

Upvotes: 1

Views: 250

Answers (1)

GregGalloway
GregGalloway

Reputation: 11625

Try a union then select into the output:

with 
pg1 as(
 SELECT count(),id 
 FROM EventHub
 where id='1'
 group by id,TumblingWindow(hour,1) 
), 
pg2 as(
 SELECT count() ,id
 FROM EventHub
 where id='2'
 group by id, TumblingWindow(hour,1) 
),
UnionStep as (
 Select count() as cnt from pg1 group by TumblingWindow(hour,1) 
 Union All
 Select count() as cnt from pg2 group by TumblingWindow(hour,1)
)
Select *
Into PowerBiAlias
From UnionStep

Upvotes: 2

Related Questions