我有查询要查找重复记录:
select min(a.rowindex)rowindx, b.rowindex rowindx1
from dedupinitial1 a,
dedupinitial1 b
where a.rowindex < b.rowindex
and a.name = b.name
group by b.rowindex
order by 1;
但这给我的结果如下:
3 182161
3 121963
3 41619
3 219762
3 163808
3 122614
3 271
3 163809
3 81
4 75060
4 60086
4 109294
4 98135
4 98468
4 165069
但我想要像
这样的结果3 182161
3 121963
3 41619
3 219762
3 163808
3 122614
3 271
3 163809
3 81
3 3
4 75060
4 60086
4 109294
4 98135
4 98468
4 165069
4 4
我的愿望结果还包括组中的3和4
答案 0 :(得分:3)
这会有用吗?
select min(a.rowindex)rowindx, b.rowindex rowindx1
from dedupinitial1 a,
dedupinitial1 b
where a.rowindex <= b.rowindex
and a.name = b.name
group by b.rowindex
order by 1;