Data Modeling

Hi All,
I have added two tables into metabse now .
How do i associate the two tables (link ) based on similar fields ?
Can please someone suggest

Thanking in advance

Hi there,

depending on what database you use underlying metabase, there are two options to join the two tables. Option one is “hard join” and will join the two tables based on a primary and a foreign key field. You can do that in the data model section of your admin area.

Option two is more flexible but requires native language (for example MySQL). When you create a new question and do not use the query builder but native language, you can join (syntax depends on your database) the two tables.

In case you use a SQL database, the syntax could look like:

select a.field1, a.field2, b.field3
from table1 a
left join table 2 b on a.field1 = b.field4

Hope that helps!
Cheers, Eva

To add a bit to what Eva already said:

See :blue_book: https://metabase.com/docs/latest/administration-guide/03-metadata-editing.html and look for Entity Key, Entity Name and Foreign Key settings.

1 Like