I have two tables
Table 1:
ref status
abc 1
abc 1
abc 2
abc 3
abc 5(not in Table2)
abc 5(not in Table2)
Table 2:
ref status
abc 1
abc 1
abc 2
abc 3
abc 4(not in Table1)
abc 4(not in Table1)
I want to join these two tables and perform a grouping so that the final result looks like this:
Resultant Table:
ref status
abc 1
abc 2
abc 3
abc 4
abc 5
I have tried this
SELECT DISTINCT Table1.ref, Table1.status, Table2.ref, Table2.status
FROM Table1, Table2
GROUP BY Table1.ref, Table1.status, Table2.ref, Table2.status;
SQL Fiddle example