How to join 2 tables with greater than value

Hi,
I’m newbie, i want to join 2 table with logical rule as below
Please help me, thank you very much

image

Hi @DMTUAN and welcome to KNIME Forum

First I thought you want to join the Code from Table A to the nearest value of No in table B.
But then code 100 should match with No=70 (instead of 150).

So what is the logical rule behind this join?

gr, Hans

1 Like

Hi @HansS
No=20 greater than Code=0 => will be match Rate=1
No=60,70 greater than Code=50 => will be match Rate=2
No=150 greater than Code=100 => will be match Rate=3
It the same logic with vlookup function in excel : vlookup(x,x,x,1)

1 Like

Hi @DMTUAN, in addition to what you mentioned,
No=60,70,150 also greater than Code=0 :slight_smile:

Similarly:
No=150 also greater than Code=50

1 Like

Hi @DMTUAN , my previous comment was meant to show that the rules you presented were still not fully precised :slight_smile:

But I could understand based on your first comment, that you want the highest number of Code where No > Code.

I put something together based on that rule and it looks like this:
image

The 2 tables (A and B) are the same as yours:
Table A:
image

Table B:
image

Here are the results of my workflow:
image

And here’s my workflow:
How to join 2 tables with greater than value.knwf (13.6 KB)

5 Likes

Thank @bruno29a ,
Very detailed and solved my problem.

3 Likes

Hello @bruno29a,

you can take advantage of Duplicate Row Filter node to replace GroupBy and Joiner node. Choose No where Code is maximum.

Br,
Ivan

3 Likes

Hi @ipazin , you are absolutely right, why didn’t think of that!! Thanks for the pointer.

I changed the workflow to reflect this:
image

Results (Same as before):
image

And here’s the new version of the workflow:
How to join 2 tables with greater than value.knwf (11.9 KB)

1 Like

You could try numeric binner as well but the workflow would probably not be shorter

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.