select a.id,a.count count1,b.count count2,a.type type1,b.type type2
from
(select id,min(count) count,min(tupe) type
from test group by id) a,
test b
where a.id=b.id
and a.count<>b.count
from
(select id,min(count) count,min(tupe) type
from test group by id) a,
test b
where a.id=b.id
and a.count<>b.count
id count type
1 2 1
1 3 2
2 5 1
2 8 5
1 9 6
2 10 6
select ...
create table tt(id number(1),name1 varchar(1),name2 varchar(1));
insert into tt (select distinct t2.id,t2.name,t3.name from t1 t2,t1 t3 where t3.id=t2.id and t2.name<>t3.name);