Consider the following table:
TAB6
A B C
---------- ---------- -
1 2 A
2 1 A
2 3 C
3 4 D
I consider, the records {1,2, A} and {2, 1, A} as duplicate. I need to select and produce the below record set:
A B C A B C
---------- ---------- - ---------- ---------- -
1 2 A or 2 1 A
2 3 C 2 3 C
3 4 D 3 4 D
I tried the below queries. But to no avail.
select t1.*
from t6 t1
, t6 t2
where t1.a <> t2.b
and t1.b <> t2.a
and t1.rowid <> t2.rowid
/
A B C
---------- ---------- -
1 2 A
2 1 A
2 1 A
2 3 C
3 4 D
3 4 D
6 rows selected.
Or even this:
select *
from t6 t1
where exists (select * from t6 t2 where t1.a <> t2.b and t1.b <> t2.a)
/
A B C
---------- ---------- -
1 2 A
2 1 A
2 3 C
3 4 D
Both did not work.
The database would be Oracle 10g. Looking for a pure SQL solution. Every help is appreciated.