Find out which records are different between two tables

Hi all,

I’m looking for a node that compares the content of two tables (current table and original table) with same structure and primary key. The result should be a new table containing all the records of current table and those of the original table that are no longer present in current table, all with an additional status field indicating the record status (identical, new, changed or deleted).

Example:

Original table contains following records (col1 and col2 contain the primary key)

col1     col2     col3     col4
-------- -------- -------- --------
1        a        12       24
1        b        45       1
2        s        37       32

Current table contains following records (col1 and col2 contain the primary key)

col1     col2     col3     col4
-------- -------- -------- --------
1        a        12       28
1        b        45       1
2        a        91       2

The resulting table should be as follows:

col1     col2     col3     col4     status
-------- -------- -------- -------- ---------
1        a        12       28       changed
1        b        45       1        identical
2        a        91       2        new
2        s        37       32       deleted

Thanks in advance for your help.
Marco

Hi @m_monti

You can concat your columns into a string. Join the concat-strings from both files and compare them with a Rule Engine, see KNIME_project.knwf (30.8 KB)
image
gr. Hans

2 Likes

Thanks a lot, Hans!
I hoped in a pre-built node, but this is a very quick solution.

1 Like

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