简体   繁体   中英

How to match multiple values in Kusto Query

Say I have a table like this

data = (Name:string, Team:string)[
   "Toma","Team1",
   "Tomb","Team2",
   "Tomc","Team3",
   "Tomd","Team2",
]

and I want to find member in team1 and team2. The way I write the query now is using

data
| where Team == "Team1" or Team == "Team2"

and it gives me what I want. Is there a way do that in a list so I do not need to write Team == "XXX"

let Teams ={ "Team1" "Team2"} 
data   
| where Team (magic here) in Teams

So I can modify the Teams variable and get the result I want.

Yes, you can simply write what you wanted:

let Teams = dynamic(["Team1","Team2"]);
data   
| where Team in (Teams)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM