查询以查找重复和重复的值

时间:2011-12-20 13:39:20

标签: oracle plsql

 select (a.rowindx) rowindx, (b.rowindx) rowindx1 
 from dedupinitial a,
     dedupinitial b 
 where a.rowindx < b.rowindx 
 and a.poivalue = b.poivalue 
 order by a.rowindx;

此查询为我提供了

之类的结果
rowindx rowindx1 
945 88715
945 91674
945 90947
945 91013
88715   91674
88715   90947
88715   91013

但我想要的结果如下:

rowindx rowindx1 

    945 88715
    945 91674
    945 90947
    945 91013

这是什么问题?

1 个答案:

答案 0 :(得分:0)

您只需要一分钟(第一列)和一个分组(第二列)

select min(a.rowindx)rowindx, b.rowindx rowindx1 
from dedupinitial a,
dedupinitial b 
where a.rowindx < b.rowindx --and a.rowindx 
 and a.poivalue = b.poivalue 
group by b.rowindx
order by 1;

PS:我不理解和a.rowindx 部分