-werners-
Esteemed Contributor III

first you have to find out what the cause of the duplicates is.

it might be that you try to join on an incomplete key. In that case you have to change your join condition.

Or perhaps you can just do a dropduplicates/distinct.

I never use sql btw to prepare data, imo you lose a lot of flexibility.