jfcb
jfcb

Reputation: 9

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?

Upvotes: 0

Views: 616

Answers (1)

danimille
danimille

Reputation: 350

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'))

Upvotes: 1

Related Questions