您可以尝试以下方法:
let customEvents = datatable(appId: string, timestamp:datetime, message:string)
[
"A", datetime(2019-03-08 16:14:50), "Hello from 'A'",
"A", datetime(2019-03-08 15:14:50), "Hello from 'A'",
"A", datetime(2019-03-08 14:14:50), "Hello from 'A'",
"A", datetime(2019-03-08 13:14:50), "Hello from 'A'",
"B", datetime(2019-03-08 12:14:50), "Hello from 'B'",
"B", datetime(2019-03-08 11:14:50), "Hello from 'B'",
"D", datetime(2019-03-08 10:14:50), "Hello from 'D'",
"C", datetime(2019-03-08 09:14:50), "Hello from 'C'",
"D", datetime(2019-03-08 08:14:50), "Hello from 'D'",
"C", datetime(2019-03-08 07:14:50), "Hello from 'C'",
]
;
let minTimeByAppId = toscalar(
customEvents
| summarize min(timestamp) by appId
| summarize make_bag(pack(appId, min_timestamp)))
;
let otherTable = datatable(appId:string, timestamp:datetime, otherMessage:string)
[
"A", datetime(2019-03-08 16:14:50), "Another hello from 'A'",
"A", datetime(2019-03-07 16:14:50), "Another hello from 'A'",
"B", datetime(2019-03-07 16:14:50), "Another hello from 'B'",
"B", datetime(2019-03-08 16:14:50), "Another hello from 'B'",
"C", datetime(2019-03-08 16:14:50), "Another hello from 'C'",
"C", datetime(2019-03-08 16:14:50), "Another hello from 'C'",
"D", datetime(2019-03-09 16:14:50), "Another hello from 'D'",
"D", datetime(2019-03-08 16:14:50), "Another hello from 'D'",
]
;
otherTable
| where timestamp < minTimeByAppId[appId] // you could also add some 'delta' here
这将输出:
| appId | timestamp | otherMessage |
|-------|-----------------------------|------------------------|
| A | 2019-03-07 16:14:50.0000000 | Another hello from 'A' |
| B | 2019-03-07 16:14:50.0000000 | Another hello from 'B' |