Skip to content

Commit

Permalink
added timeseries query sample
Browse files Browse the repository at this point in the history
  • Loading branch information
yorek committed Nov 24, 2020
1 parent 7a68c7a commit 03ea4f6
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions eventhubs-streamanalytics-azuresql/time-series-query-sample.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
database: streaming@dmiot002sql
*/
declare @p table (pid int);
insert into @p values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16);

select top (100)
*
from
@p p
cross apply
(
select top (100)
*
from
dbo.[rawdata2] r
where
r.[PartitionId] = p.pid
order by
[StoredAt] desc
) t
order by
[StoredAt] desc
go

select top (100)
*
from
dbo.[rawdata2] r
where
[r].[DeviceId] = 'contoso://device-id-154'
and
r.[PartitionId] = 5
order by
[StoredAt] desc

0 comments on commit 03ea4f6

Please sign in to comment.