Error Using Variables

Dear, good afternoon!

Using the sample database (H2), I’m creating a question to display all people, where cities will be selected by the user. But Metabase is returning an error that I could not resolve. Can you help me. I’m using variables of type “Field Filter”.

Query: select * from PEOPLE where CITY = {{city}}

Hi @Lourival
When you’re using Field Filters, then your query should only include the variable and not the column.

SELECT * FROM "PEOPLE" WHERE {{variable}}

https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html#the-field-filter-variable-type

Hi @flamber

Thank you so much, my dear. I had not realized this remark.

But … look at this other case. The ts_movimentacao column exists in the tb_registrar_assinatura_cliente table, and even then Metabase issues an error. See the attachment.

@Lourival
You cannot use aliases, when using Field Filter.

Ok, very well.
Thanks!

@flamber, how to send you a private message? Looks like it’s blocked for you.

I don’t provide private support, that’s why :slight_smile:

1 Like

Ok, vou postar a dúvida aqui no fórum…