Interviews - C# Corner

Nilesh Avhad
How to find only duplicate records from the table in SQL server?
By Nilesh Avhad in SQL Server onJul 16 2014
  • shambhoo prajapati
    Aug, 2014 28

    select name from emp group by name HAVING COUNT(*) > 1

    • 1
  • Jiyaul Mustapha
    Jul, 2019 12

    /To get duplicate data in table /

    SELECT COUNT(EmpCode),EmpCode FROM tbl_Employees WHERE Status=1
    GROUP BY EmpCode HAVING COUNT(EmpCode) > 1

    • 0
  • Lalit Raghuvanshi
    Feb, 2015 5

    Please refer the article Remove duplicate records/data from Sql Server database table http://www.webcodeexpert.com/2013/11/how-to-remove-duplicate-recordsdata.html

    • 0
  • shushil kumar
    Aug, 2014 26

    select id, count(*) as numberduplicate from TableName group by id having count(*) >1 order by id

    • 0
  • Rabinarayana Nanda
    Aug, 2014 5

    select COLUMNNAME from TABLENAME group by COLUMNNAME having COUNT(COLUMNNAME )>1

    • 0
  • Guest User
    Aug, 2014 1

    I agree with Sandesh's answer

    • 0
  • Sandesh Patil
    Jul, 2014 24

    with x as (select *, rn=ROW_NUMBER()over(PARTITION BY username, userrole order by userid) from t_user )select * from x where rn>1

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS