'Pyspark inner join 3 tables

My goal is joining 3 tables in Pyspark dataframes,

TableA, TableB and TableC all have an ID like a Key to merge.

I want to join three tables and create a new Pyspark dataframe.

Do you have any suggestions?



Solution 1:[1]

You can simply join them as below:

final_table = (tableA.join(tableB, on = [tableA.ID == tableB.ID], how = 'inner')
                     .join(tableC, on = [tableA.ID == tableB.ID], how = 'inner'))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 danimille