SELECT A.Column1,A.Column2, Name, Address FROM A, B
WHERE (
(A.COLUMN1 = B.COLUMN1) OR (A.COLUMN2 = B.COLUMN2)
)
Cause: Imagine there are rows in A and B that satisfy the two join conditions used in OR, In such a scenario the database will return two rows with same value.
Here as per the query, for row 'Athul' in Table A, both the join conditions match with B and hence will return below output resultset,
As you can see in the result above, 'Athul' is resulted twice. However for the second recrod
Solution: This can be avoided by using a LEFT join instead of an OR join condition. Do not consider using DISTINCT as it is a fairly cost consuming alternative.