There are two tables
tabA1 tabA2
NUM CODE CODE ITEMS
1001 A A paper
1002 B C milk
1003 C E paper
1004 A
1005 B
1006 B
output should be
output
CODE CODE_1
A A
B
C C
E
Using full outer join and distinct keyword
The Query
SELECT
A1.Code, A2.Code
FROM
(SELECT DISTINCT Code FROM TabA1) A1
FULL OUTER JOIN
(SELECT DISTINCT Code FROM TabA2) A2
ON A1.Code = A2.Code
Using join and UNION operator
The Query
SELECT t1.Code, t2.Code
FROM TabA1 T1,TABA2 T2
WHERE t1.code=t2.code(+) --left outerjoin
UNION
SELECT t1.Code, t2.Code
FROM TabA1 T1,TABA2 T2
WHERE t1.code(+)=t2.code --right outer join
output on tool
![](https://oraclesql.in/wp-content/uploads/2020/10/o-distinct-value-from-2-table.png)