Write a query to delete duplicate records in SQL SERVER

Answer Posted / prem

Hi All,

I want to display all duplicate records in the table. My
query has to fetch all the records which are duplicate(First
Name or Last Name). Also I want the ability to also pull
names where there might be a middle initial placed in the
end of the first name field, (i.e., "Maria Z. " vs. "Maria")
as well.

Please guide me to find this.



Table:

ID FirstName LastName

1 Zach H Hoffman

2 Zach Hoffman

3 Troy Hoffman

4 Shawn Livermore

5 Prem S

6 Jony Hoffman H

7 Zach Modan



I need the query to filter.........

ID FirstName LastName

1 Zach H Hoffman

2 Zach Hoffman

3 Troy Hoffman

6 Jony Hoffman H

7 Zach Modan



I hope this example will give you clear idea.....




Thanks in Advance

Prem

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How data can be copied from one table to another table?

514


Your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files?

619


What is the difference between join and inner join?

541


What is public role in sql server?

540


What happens if null values are involved in bitwise operations?

608






List some case manipulation functions in sql?

599


What is fill factor and pad index?

548


How to find out the list schema name and table name for the database?

533


mention different types of relationships in the dbms?

509


How to create new databases with "create database" statements?

570


What factors you will consider calculating the storage requirement for that view?

552


What are the types of normalization?

556


What is SQL Azure Fabric?

92


What is the command used to recompile the stored procedure at run time?

625


How to connect to SQL Azure Database by using sqlcmd?

110