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

Answers were Sorted based on User's Feedback



Hi All, I want to display all duplicate records in the table. My query has to fetch all the reco..

Answer / eralper

Hello Prem,
Please check the forum post
http://www.kodyaz.com/forums/thread/21123.aspx for solution
of your question. I see that you have asked this question
on several forums. That is a good idea to find an answer :)

Is This Answer Correct ?    1 Yes 0 No

Hi All, I want to display all duplicate records in the table. My query has to fetch all the reco..

Answer / vamsi

select id,Lastname, firstname from record where FirstName like 'Hoffman%' or LastName='Zach'

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What are the different types of join?

0 Answers  


What is usually the first word in a sql query?

0 Answers  


How self join is different from outer join?

0 Answers   Blue Star,


What is a Stored Procedure?

8 Answers  


What is better - 2nd Normal form or 3rd normal form? Why?

2 Answers   TCS, TPK,






Explain the different types of joins?

0 Answers  


what is the difference between Delete and Truncate command in SQL

0 Answers   BirlaSoft,


Tell about MOM Tool(Microsoft Operator Manager)?

0 Answers  


Explain database normalization?

0 Answers  


What is The Use Of TIMESTAMP DataType in SQL Server 2005?

6 Answers  


How many types of Joins in SQL Server 2005?

9 Answers   CarrizalSoft Technologies, HCL,


How sql server enhances scalability of the database system?

0 Answers  


Categories