How to put enum fielter which is not "field filter"

Hello Heroes,

I have a query like this in Metabase.

SELECT account_type IN {{ account_type }}
FROM accounts;

{{ account_type }} is set as a field filter and referred to metabase_data1 table’s account_type field

It generates this query completely wrong which cannot be executed in Postgres.

SELECT account_type IN “public”.“metabase_data1”.“account_type” IN (‘user’)
FROM accounts;

But expected to generate

SELECT account_type IN (‘user’)
FROM accounts;

Could you pls help me to find out what should I do.?

Hi @armen-g
You can currently only use Field Filters in the WHERE clause.
https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html#the-field-filter-variable-type
You might be interested in several of the issues linked in this (upvote by clicking :+1: on the first post of each issue):
https://github.com/metabase/metabase/issues/11531

Hi @flamber,

Thank you for the response. Even in where clause it works same way. it generates totally wrong query.
The github issue you have linked is not the same BTW.

@armen-g If you check the documentation, then notice that Field Filters should not include the column, since it will automatically add that, so your query will look like this:

SELECT *
FROM accounts
WHERE {{ account_type }}