Knowledge Drops

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

  • 5 April 2021
  • 0 replies
  • 1032 views

Userlevel 5
Badge
  • New Member
  • 163 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} = ${person.id} ;; } join: representative { from: person sql_on: ${order.representative_id} = ${representative.id} ;; }}

This content is subject to limited support.                

 

 


0 replies

Be the first to reply!

Reply