Joining tables on more than one field

  • 7 June 2019
  • 2 replies

Hi, I have two tables, let’s call them Table A and Table B. There are three fields that make up the join between these two tables. Let’s call those Fields 1, 2 and 3 and for the purpose of my question, let’s say those fields have the same names in both tables.

To possibly make things even more complicated, Fields 1 & 2 are many-to-one joins, but Field 3 is one-to-one.

How do I build that join in LookML? I’ve only done joins that have one field to join on so I’m completely baffled.

Thanks in advance!


2 replies

Userlevel 5

If two of them are n:1 and one is 1:1, the overall impact of the join is that it will be a many to one relationship. I’ve not done this either, but I’d imagine a sql_on with AND to separate the conditions (base.fieldA = jointable.fieldA AND base.fieldB = jointable.fieldB AND base.fieldC = jointable.fieldC) would work. Have you tried this yet?



Hi Ben,

Thanks for that. I wasn’t sure about the syntax for joining on more than one field no matter the relationship. I didn’t know if it was the same as in SQL.

I’ll give it a shot. I appreciate the help!