我是 Kusto 语言的新手——请帮我创建查询。
这里数据集:
let T = datatable(d:datetime , s:string)
[
datetime(2019-10-01T00:01:00.00), "A",
datetime(2019-10-01T00:02:00.00), "A",
datetime(2019-10-01T00:03:00.00), "A",
datetime(2019-10-02T00:01:00.00), "A",
datetime(2019-10-02T00:02:00.00), "A",
datetime(2019-10-02T00:03:00.00), "A",
datetime(2019-10-01T00:01:00.00), "C",
datetime(2019-10-01T00:02:00.00), "C",
datetime(2019-10-02T00:01:00.00), "C",
datetime(2019-10-02T00:02:00.00), "C",
datetime(2019-10-01T00:01:00.00), "D",
datetime(2019-10-02T00:01:00.00), "D",
datetime(2019-10-01T00:01:00.00), "E",
datetime(2019-10-02T00:01:00.00), "E",
];
我希望与其他人一起获得每个“s”字符串的前 2 个并按天汇总。即结果需要是:
2019-10-01T00:00:00Z A 3
2019-10-01T00:00:00Z C 2
2019-10-01T00:00:00Z Other 2
2019-10-02T00:00:00Z A 3
2019-10-02T00:00:00Z C 2
2019-10-02T00:00:00Z Other 2
我想我以查询结束:
T
| summarize c = count() by bin(d, 1d), s
| top-nested of d by dummy0 = max(0)
| top-nested 2 of s with others = "Other" by c0 = sum(c);
但它不起作用。
请指教。