Vertica Compare table content
<p>I have the following two tables in Vertica with column names A, B, C, D. I've listed the row values below</p>

<pre><code>Table 1

100, Active, R, 80
200, Inactive, R, 20
300, Active, V, 50
500, Active, R, 30

Table 2

100, Active, R, 80
200, Inactive, R, 20
300, Inactive, V, 50
400, Inactive, R, 60
</code></pre>

<p>I'd like to compare these two tables and only print the rows which are different between these two tables and rows which are present in one, but not in the other table. I tried the following SQL, which works for one scenario ( It's able to provide the rows which are present in one and not in the other, but it's not able to )</p>

<pre><code>select * from (select A,B,C,D from Table1 except select A,B,C,D from Table2) "T" union all select * from (A,B,C,D from Table2 except select A,B,C,D from Table1) "T";

300, Active, V, 50
300, Inactive, V, 50
500, Active, R, 30
400, Inactive, R, 60
</code></pre>

<p>But I'd like to have only one row when there the same row is present in both tables with different values:</p>

<pre><code>300, Inactive, V, 50
500, Active, R, 30
400, Inactive, R, 60
</code></pre>