Selecting only updated record in delta <p>Trying to compare 2 tables in the same db. Table 1 is the main historical table, table 2 is the temporary table with new data rcvd from server and used to update table 1. </p> <p>Need to output the items in table 1 that have a change in one of the fields on table 2. </p> <p>i.e. table 1(Services)</p> <pre> Service - folder- s2 - Real - s4 astatus - on - on - on - on </pre> <p>table 2(Services2)</p> <pre> Service - folder - s2 - Real - s4 astatus - on - on - off - on </pre> <p>So I need the output to indicate that Real in astatus table 1 is off (again table 2 is just the reference temp table with new data to update table 1) I have all the updates and remaining code done. But i'm stuck on this comparison part...</p> <p>my code is as follows:</p> <pre><code>cursor.execute("""Select inner.compare FROM (Select a.Real = aReal, b.Real = bReal FROM Services a JOIN Services2 b ON (lower(a.Service || a.Folder) = lower(b.Service || b.Folder)))inner.compare WHERE inner.astat != inner.bstat""") print inner.compare </code></pre>