I have two tables in a vertica DB. First table has N+1 columns the second has N columns. I want to find the rows that have the same content but not necessary in the same order, to link the extra column to the second table. Here is an example for N=3:

Table1:

```
+-------+-------+-------+-------+
| Item1 | Item2 | Item3 | Value |
+-------+-------+-------+-------+
| A     | B     | C     |     3 |
| C     | D     | E     |     2 |
+-------+-------+-------+-------+

```

Table2:

```
+-------+-------+-------+
| Item1 | Item2 | Item3 |
+-------+-------+-------+
| C     | F     | E     |
| C     | A     | B     |
+-------+-------+-------+

```

As you can see, in terms of row content the first row from Table1 is equal to the second row from Table2 just (expect the Value column) in a different order. So my question is: Is there a way to link both table in order to copy the Value to Table. To get the final Table.

TableF:

```
+-------+-------+-------+-------+
| Item1 | Item2 | Item3 | Value |
+-------+-------+-------+-------+
| C     | A     | B     |     3 |
+-------+-------+-------+-------+

```

Possible solution would be to order both table alphanumerical (Table1\_sorted, Table2\_sorted) like this:

```
SELECT T2.Item1, T2.Item2, T2.Item3, T1.Value 
FROM Table1_sorted T1, Table2_sorted T2 
WHERE T1.Item1=T2.Item1 AND T1.Item2 = T2.Item2 AND T1.Item3 = T2.Item3

```

However sorting alphanumerical is fairly complicated. Another way would be to use a bunch of `AND` `OR` combinations which is also not ideal. I was wondering if there is an easier solution.

Thanks!