How to match multiple values in Kusto Query

Viewed 1721

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.

1 Answers

Yes, you can simply write what you wanted:

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