Create questions from multiple tables (SQL Join?)


Over the past few months I have created many SQL queries to retrieve the data from our MySQL database. Then I found Metabase which creates the charts for us and it’s very helpful to understand the data we need.

The problem is that now with all the enhancements with the Metabase Questions I want to migrate my SQL to Metabase Questios, which I can’t. The biggest problem is that I can’t find how to JOIN fields from other tables or filter by them.

Eg. I have an ID eg. 1888, for a user on table A and I want to retrieve the name for this ID eg. Paul from the User’s table.

Is this possible? If yes could someone let me know how to do it? Any Guide? Video? Screenshots? If not, do you know when it will be possible?

Hi there, I’m just a user like you but I thought I’d answer…

You can put all our sql directly into metabase. There’s a button when creating your question that opens a sql text box.Just be careful with the columns your query returns, sometimes metabase won’t be able to create a chart.

You can also simplify metabase questions by creating views in your db. This way you can use the query builder gui which is very nice for non-sql savvy users. It also makes your life easier in my opinion while managing your questions on metabase.

Hi @dcnpax,

I already have imported all my SQL Queries on Metabase and they are working almost as expected. I just want to create Metabase Questions because now they allow for relative dates selection and other stuff. These features would be extremely useful to my team.

Sadly I cannot create views or edit the database as it’s being handled by the software company that we bought the software from, so I have only read permissions.

Have you tried configuring foreign keys in your metadata?

Admin > Data Model > [Your Table]

You should now be able to access the related table:

More info here:

1 Like