# Compare Two Tables based on Three Columns

**URL:** <https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330>\
**Category:** KNIME Analytics Platform\
**Created:** [April 3, 2017, 7:03am UTC](https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330 "2017-04-03T07:03:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nagaraja\_Ganiga](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/n/7c8e57/32.png) [@Nagaraja\_Ganiga](https://forum.knime.com/u/Nagaraja_Ganiga)\
**Post date:** [April 3, 2017, 7:03am UTC](https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330/1 "2017-04-03T07:03:15Z")

</div>

Hi everyone,

&nbsp;

I need to compare two tables I have, to get the third table. The condition is that&nbsp; **If Col1.Table1==Col1.Table2 AND Col2.Table1==Col2.Table2 AND Col3.Table1!=Col3.Table2.**

**For instance:**

**Table 1:&nbsp;**

&nbsp; &nbsp; &nbsp; Name &nbsp; &nbsp;Category &nbsp; &nbsp; &nbsp; &nbsp;Date &nbsp; &nbsp;&nbsp;

1) &nbsp; X &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1/1/2001

2) &nbsp; Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2/15/2004

3) &nbsp; Z &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; C &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5/20/2014

&nbsp;

&nbsp;

**Table 2:**

&nbsp; &nbsp; &nbsp; Name &nbsp; &nbsp;Category &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Date &nbsp; &nbsp;&nbsp;

1) &nbsp;X &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1/31/2001

2) &nbsp;Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; P &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3/15/2004

3) &nbsp;Z &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; C &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5/20/2014

&nbsp;

**Resultant Table:**

&nbsp; &nbsp; &nbsp; &nbsp;Name &nbsp; &nbsp;Category &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Date &nbsp; &nbsp;&nbsp;

1) &nbsp; X &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1/31/2001

&nbsp;

So here in the above example I have only one record in the resultant table where&nbsp; **Name** &nbsp;and&nbsp; **Category** &nbsp; **are** &nbsp; **same** &nbsp;but&nbsp; **Date is different**.

I need a workflow for this, I tried Math Formula but result wasn't as expected.

&nbsp;

Thanks.

---

<div class="post-metadata">

**Author:** ![mauuuuu5](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mauuuuu5/32/351_2.png) [@mauuuuu5](https://forum.knime.com/u/mauuuuu5)\
**Post date:** [April 4, 2017, 4:02am UTC](https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330/2 "2017-04-04T04:02:35Z")

</div>

Hi&nbsp;Nagaraja\_Ganiga, probably these post may help you&nbsp;

Post 1:&nbsp;[https://tech.knime.org/forum/knime-general/comparing-multiple-values-from-different-tables](https://forum.knime.com/forum/knime-general/comparing-multiple-values-from-different-tables)

Post 2:&nbsp;[https://tech.knime.org/forum/knime-general/comparing-two-tables-identifying-different-rows-combining-tables](https://forum.knime.com/forum/knime-general/comparing-two-tables-identifying-different-rows-combining-tables)

However I think that knime should develop a node that allows you to input several tables and make conditional filters on them, something like its done in the auditing software tools, that read multiple tables and you make filters on them like IF Table1.ColumnA\>4333 AND Table2.ColumnH="ABC" OR Table3.ColumnJ!=9993.

Here is a example of such software:

[http://bit.ly/2nVl3qE](http://bit.ly/2nVl3qE)

Best Regards

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Nagaraja\_Ganiga](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/n/7c8e57/32.png) [@Nagaraja\_Ganiga](https://forum.knime.com/u/Nagaraja_Ganiga)\
**Post date:** [April 6, 2017, 10:34am UTC](https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330/3 "2017-04-06T10:34:11Z")

</div>

Hi,

&nbsp;

Thanks for the reply, Yes I need conditional filtering node which I'm not able to find.

Anyway,

Thank you.

---

<div class="post-metadata">

**Author:** ![mauuuuu5](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mauuuuu5/32/351_2.png) [@mauuuuu5](https://forum.knime.com/u/mauuuuu5)\
**Post date:** [September 23, 2018, 3:43am UTC](https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330/4 "2018-09-23T03:43:10Z")

</div>

> [@mauuuuu5](#):
>
> comparing-two-tables-identifying-different-rows-combining-tables

The new links are

> [@Comparing Multiple Values From Different Tables](https://forum.knime.com/t/comparing-multiple-values-from-different-tables/5227/2):
>
> The "Reference Row Filter" node avoids joining, and returns either the identical or the non-identical items (your choice). Maybe that'd work? Cheers E

> [@Comparing two tables =\> identifying different rows =\> combining tables](https://forum.knime.com/t/comparing-two-tables-identifying-different-rows-combining-tables/2883/4):
>
> I am not 100% sure you want this, but here is a sample workflow. It shows how to do this with the title as distinguising feature and also when you want to use both title and author. [compare.zip](https://www.knime.com/sites/default/files/compare.zip)

---

<div class="post-metadata">

**Author:** ![izaychik63](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/e9a140/32.png) [@izaychik63](https://forum.knime.com/u/izaychik63)\
**Post date:** [September 23, 2018, 11:58am UTC](https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330/5 "2018-09-23T11:58:57Z")

</div>

It sounds like Joiner node will do the job: [https://nodepit.com/node/org.knime.base.node.preproc.joiner.Joiner2NodeFactory](https://nodepit.com/node/org.knime.base.node.preproc.joiner.Joiner2NodeFactory)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 23, 2023, 8:23pm UTC](https://forum.knime.com/t/compare-two-tables-based-on-three-columns/6330/6 "2023-06-23T20:23:09Z")

</div>


