How to perform a join of tables based on content?

Hi all,
I have to tables which I want to join. However, the column I want to join on in the second table depends on the value per each row in the first table.
image

Does anyone has an idea how to realise this?

Many thanks!

Hi @PeterV99, welcome to the forum.

In this situation, you’ll need to unpivot your 2nd table to give a table with 3 columns: year, code, and planet.

Once this is done, then you can join this table with table 1 on year and code.

3 Likes

Hi @PeterV99,

below a small example how to do it.
As @elsamuel said the Unpivot Node should do most of the work you need to do :slight_smile:
(@elsamuel you were a bit faster :+1: just put my example here so the work is not wasted :P)

Workflow Overview:

Table 2 (as Table Creator)
grafik

Unpivot config:

Joining with prepared columns

Result:
grafik

Example Workflow:
KNIME_project30.knwf (13.5 KB)

4 Likes

Hi both of you,
This does the trick! Thank you both for your swift support!

2 Likes

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