How can I create a field filter that would get its options from another table?

I have a question that selects data from table1. I want add to the question a field filter that would receive its options from the values of a column in table2.

I tried the following:

SELECT id, name, value
    FROM table1
    WHERE {{id}}

But received the following error:

ERROR: missing FROM-clause entry for table "table2"

How can I achieve this?

Hi @eero
Please read this: https://www.metabase.com/learn/sql-questions/field-filters
Specifically: https://www.metabase.com/learn/sql-questions/field-filters#creating-a-filter-widget-with-a-dropdown-menu

I have read it and I read it now again. I do not see how that answers my question though. I know how to make a field filter dropdown menu for a table if it uses the options from its own column values. In my opinion my situation is different though.

@eero You would do something like this:

SELECT table1.id, table1.name, table1.value
    FROM table1
    LEFT JOIN table2 ON table2.id=table1.id
    WHERE {{id}}
2 Likes