Join on Multiple Criteria with Or Statement
I am wondering if there is a way to join two datasets with one column or another column (ie. match on customer code or on custmer name). It seems that if you specify multiple criteria in the join it is always an and statement. Thanks.
-
Below is an example. I need to join based on Customer Number or Customer Identifier to pull in the "data to be pulled in Join" column in the right table (left join). You can see sometime there is a match on only number or identifier in the original table. I do not see an easy way to accomplish this.
-
What do you expect the output to look like if a record matches both values? Is there any time where a record would match differently between the Customer Number and Customer Identifier? Also, what size are the data sets? This can influence how complex a solution should be versus how performant.
My initial thoughts are to join based on the Customer Number only. Independently join on the Customer Identifier. Then union these two sets and use grouping to eliminate potential duplicates.
Please sign in to leave a comment.
Comments
4 comments