如何使用联合从两个表中获取不同的值?

How can I get distinct values from two tables using union?

如何使用 KQL 从两个表中获取不同的值?

我尝试了以下方法

let brandstorelensscandevicedata = scandevicedata
| distinct Brand
| where Brand != "null";
let brandresellapp = usertrackerdevicedata
| distinct Brand
| where Brand != "null";
brandstorelensscandevicedata
| union kind=inner brandresellapp

但是当两个表中都存在一个品牌时,它会给我重复项

如何从两个表中获得独特的品牌并避免重复?

// Data sample generation. Not part of the solution
let scandevicedata = materialize(range i from 1 to 10 step 1 | extend Brand = iff(rand()<0.2, "null", strcat("Brand_", toint(rand(9)))), x1 = rand(), x2 = rand());
let usertrackerdevicedata = materialize(range i from 1 to 10 step 1 | extend Brand = iff(rand()<0.2, "null", strcat("Brand_", toint(rand(9)))), x1 = rand(), x3 = rand());
// Solution starts here
union scandevicedata, usertrackerdevicedata
| distinct Brand
| where Brand != "null"
Brand
Brand_6
Brand_7
Brand_2
Brand_0
Brand_5
Brand_8

Fiddle