I have two tables with the following schema
id, fruit
In TableA the values are like this:
A01, Apple
A02, Orange
A03, Pineapple
A03, Pineapple
A05, Banana
In TableB the values are like this:
A01, Apple
A02, Orange
A03, Pineapple
A04, Pineapple
A05, Banana
How can I reconcile these two tables to return just the duplicate row A03 in TableA? Like a one-to-one comparison of the tuples and returning the odd tuple.
I tried the minus query like below
Select * from TableA
minus
Select * from TableB
But that's not returning the result set I expected.
Best Answer
One-to-one based on what?
You have no reliable and permanent way of identifying/sorting rows in TableA. You have
A03, Pineapple
twice. Which will be the 3rd and which will be the 4th?Sure, you can do the below, but forget this right away and fix your data. Rowids can change when moving data so the order is never guaranteed.