My requirement
I want to calculate the time for the car into the tunnel for that, I have JSON like (I have populated this JSON into Stream Analytics input job)
[{
CarId: 1,
Time: "2017-03-08T16:20:00.0000000",
CarNum: "XYZ"
},{
CarId: 2,
Time: "2017-03-08T16:25:00.0000000",
CarNum: "ABC"
},{
CarId: 1,
Time: "2017-03-08T16:27:00.0000000",
CarNum: "XYZ"
},{
CarId: 1,
Time: "2017-03-08T16:30:00.0000000",
CarNum: "XYZ"
},{
CarId: 1,
Time: "2017-03-08T16:35:00.0000000",
CarNum: "XYZ"
},
]
Now Minimum time for the car to be into the tunnel is 1 minute and the maximum time is 10 min.
Based on input it is 2 visits for CarId 1 and 0 visit for CarId 2
Can anyone help me to write the query?