select t1.Id,t1.a,t1.b fromTable1 t1 inner join(select a,b,count(*)as num fromTable1groupby a,b having count(*)>1) t2 on t1.A=t2.A and t1.B=t2.b
select t1.Id,t1.a,t1.b fromTable1 t1 inner join(select a,b,ROW_NUMBER() OVER (PARTITION BY a,b ORDER BY a,b)as num fromTable1groupby a,b having count(*)>1) t2 on t1.A=t2.A and t1.B=t2.b
Need Help finding duplicates in SQL
in SQL
Posted
Try either of them