Knowledge Drops

How to join the same table twice (self-join)

  • 5 April 2021
  • 0 replies

Userlevel 5
  • Looker Staff
  • 173 replies

Last Tested: March 22, 2021

In a given explore, each join name must be unique. To self-join the same table multiple times you can use the from parameter, as mentioned in the docs, to change the "join" name of the table.

In this example, we join in person to order twice, with different names and different joining dimensions.

explore: order { join: person { sql_on: ${order.customer_id} = ${} ;; } join: representative { from: person sql_on: ${order.representative_id} = ${} ;; }}

This content is subject to limited support.                



0 replies

Be the first to reply!