IN clause when defining parameters

Suppose we have this query:

select count(*) from T where month IN ({{month}});

Specifying text variable month as August works, since It is translated into:

where day IN ('August')

However, a typical use case for IN would need a list of items to be specified. Can't specify month as something that would translate to:

where month IN ('July','August')

When I Fill parameter cell with July, August with no quotes it gives me back an empty cell in the result.

I am running ATHENA SQL.

Any hint?


Hi @aresb
Metabase adds quoting around variables to protect again SQL injection.
You would need to use Field Filter, or use a Text variable where you split based on commas - see examples in this issue for variable database types: - upvote by clicking :+1: on the first post

1 Like