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

解决方案 »

  1.   

    wwl007(疑难杂症)你好,如果记录变化了一下该怎么办?比如:
    id   count  type
    1      2       1
    1      3       2
    2      5       1
    2      8       5
    1      9       6
    2      10      6
      

  2.   

    create view viewname as
    select ...
      

  3.   

    不知道下面的程序能不能符合要求select distinct t2.id,t2.name,t3.name from t1 t2,t1 t3 where t3.id=t2.id and t2.name<>t3.name;
    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);