Jump to content

Sherin

Members
  • Posts

    76
  • Joined

  • Last visited

Posts posted by Sherin

  1. Try either of them

    select t1.Id,t1.a,t1.b from Table1 t1 inner join 
    (select a,b,count(*) as num from Table1  group by a,b having count(*)>1) t2 on t1.A=t2.A and t1.B=t2.

     

    select t1.Id,t1.a,t1.b from Table1 t1 inner join 
    (select a,b,ROW_NUMBER() OVER (PARTITION BY a,b ORDER BY a,b) as num from Table1 group by a,b having count(*)>1) t2 on t1.A=t2.A and t1.B=t2.
×
×
  • Create New...