Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

Join with numeric comparison

$
0
0

Hi everyone,

 

A few weeks ago I had this question, for which @jdunkerley79 suggested a great solution.

Now I have the same problem, but with a slight difference: two new columns, Salary Range (min) and Salary Range (max), that must be considered in the join. So, my table A now looks like this:

 

BenefitCompanyLocationUnitTrackLevelSalary Range (min)Salary Range (max)Value
Transport     100019991830
Transport     20003999 
Transport     4000  
Medical       8241
Car Plan    5  26217
Car Plan    6  23222
Car Plan    7  21054
Car Plan    8  18998
Lunch LocA     25
Lunch LocB     26
Lunch LocC     32

 

 

On the other table, as I said in the other post, I have all the combinantios for the columns Company, Location, Unit, Track and Level. But now I also have a new column, Salary, which I want to be considered in the join.

 

My idea is to keep the same behavior described on the previous post (joining with nulls) and also be able to match using the Salary ranges. For example, if the Salary Range (min) is 1000 and Salary Range (max) is 1999 on the first table, a row on the second table should only be joined if the value of it's Salary column is between 1000 and 1999. If one of the Salary Range columns is empty, then it should consider that it have no limit: for example, if Salary Range (min) is empty and Salary Range (max) has a value, we have only a upper limit. And if we don't have information neither for min or max, we should consider only the other columns on the join.

 

Can anyone help me solving this problem?

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 4999

Trending Articles