create table t1(c varchar2(1));
insert into t1 values('A');
insert into t1 values('B');
insert into t1 values('C');
create table t2(c varchar2(1));
insert into t2 values('D');
insert into t2 values('E');
insert into t2 values('F');
commit;
----------------------------------------------------
with t as (select c from t1 union select c from t2)
select a1.c||'-'||a2.c output
from t a1, t a2
where a1.c < a2.c;
----------------------------------------------------
with t as (select c from t1 union select c from t2)
select distinct least(a1.c,a2.c), greatest(a1.c,a2.c) output
from t a1, t a2
where a1.c <> a2.c
order by 1;
----------------------------------------------------
No comments:
Post a Comment