我已经汇总了表格数据。询问:
ABC
| where Timestamp >ago(30d) and isnotempty( TotalVehDist_Cval_CPC) and Vin =='ABC'
| project Vin, Longitude_Cval_CTP, Latitude_Cval_CTP, Timestamp//, VehSpd_Cval_CPC, Trigger,Type
| order by Vin, Timestamp asc
| extend Distance= tolong(geo_distance_2points(Longitude_Cval_CTP,Latitude_Cval_CTP,prev(Longitude_Cval_CTP),prev(Latitude_Cval_CTP)))
|extend Time = iff(Vin==prev(Vin),datetime_diff('minute',Timestamp,prev(Timestamp)),toint(""))
| summarize Events=count(), arg_min(Timestamp, Longitude_Cval_CTP, Latitude_Cval_CTP), arg_max(Timestamp, Longitude_Cval_CTP, Latitude_Cval_CTP) by Vin//,Distance,Time
| project Vin, Timestamp,Longitude_Cval_CTP,Latitude_Cval_CTP,start=Timestamp,End=Timestamp1,Events;
Output is:
Vin Timestamp start End Events
ABC 6/6/2021 06/06/21 6/6/2021 12:50 6
我在同一张桌子上有第二个查询。
ABC
|where Vin == 'ABC' and isnotempty( TotalVehDist_Cval_CPC) and Timestamp >=datetime(2021-06-06 12:01:08.455) and Timestamp <= datetime(2021-06-06 12:50:10.061)
|project Vin, Timestamp;
输出是:
Vin Timestamp
ABC 2021-06-06 12:01:08.4550000
ABC 2021-06-06 12:06:08.4590000
ABC 2021-06-06 12:11:08.4570000
ABC 2021-06-06 12:42:57.0000000
ABC 2021-06-06 12:45:10.1160000
ABC 2021-06-06 12:50:10.0610000
所以我想加入这个关于开始时间和结束时间的查询。我尝试:让 q2=
ABC
|where Vin == 'ABC' and isnotempty( TotalVehDist_Cval_CPC)
|project Vin,Longitude_Cval_CTP, Latitude_Cval_CTP, Timestamp;
q2
| join q1 on Timestamp, $left.Timestamp == $right.start
|where Timestamp between (start..End)
|project Vin1,Timestamp1
输出为:ABC 2021-06-06 12:01:08.4550000
预期输出为 6 行 Stattime=2021-06-06 12:01:08.4550000 和 endtime=ABC 2021-06-06 12:50:10.0610000