Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Dealing with Duplicate When Joining (Left Join) 3 Tables ( With many columns as PK)

Christopher_ZK
6 - Meteoroid

Hello Everyone,

I have a problem with duplicate records when joining my tables
Table 1 ( P_ID and G_ID as Primary Key)
Table 2  ( P_ID as Primary Key )
Table 3 ( P_ID and G_ID and F_ID as Primary Key )

I did my table joining as :

Join 1 : Table 1 and Table 2 ON table1.P_ID = table2.P_ID
Join 2 : Result of Join 1 and Table 3 ON ResultJoin1.P_ID = table3.P_ID AND ResultJoin1.G_ID = table3.G_ID

The final table has duplicate records , i know it's normal cause my tables don't have the same columns as Primary Key

Can you guide me to avoid these duplicate records please ?

Thanks 

6 REPLIES 6
Felipe_Ribeir0
16 - Nebula

Hi @Christopher_ZK 

 

One way to avoid duplicates on this case, you could put an unique tool right before the join's:

 

Felipe_Ribeir0_0-1669055138252.png

 

DenisZ
11 - Bolide

If you are referring to that  P_ID are shown double, then you can deselect them in the join tool. Otherwise, you can use a unique tool to filter out duplicate values. 

 

Hope it helps. 

Christopher_ZK
6 - Meteoroid

Hi @Felipe_Ribeir0

 

Thanks you for replying 

I just wanna know the order of tables is important ? 

why did you start with table 3 please ?  

Cause for me the duplicate is located in tables with more columns as Primary Key , So you have to put the unique tool in front of tables 3 to take unique of the column(s) it has in common with the other table , maybe i get something wrong But why did you put the unique tool in front of the tables that have these columns as Primary Key ?


King regards

Felipe_Ribeir0
16 - Nebula

Hi @Christopher_ZK 

 

Dont worry about the specific order of the print, it was only an example (as i dont know exactly how your data looks like). Just adapt the idea of removing duplicates based on the key columns using the unique tool before of the join for the necessary tables and i think that it gonna work.

Christopher_ZK
6 - Meteoroid

Thanks ,

I will do it and i will come back 

Kind regards 

simonaubert_bd
13 - Pulsar

Hello @Christopher_ZK 

If you use In db tools, you must use a summarize in db in order to aggregate your data and avoid duplicate.

simonaubert_bd_0-1677014394922.png



Best regards,

Simon

Labels