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 is a view and what are its advantages?

0 Answers  


Why should you use or avoid select * statements?

0 Answers  


What is a table called, if it does not have neither Cluster nor Non-cluster Index?

2 Answers  


What is the maximum size of column in sql server?

0 Answers  


What is sql language?

0 Answers  






What is difference between primary key and foreign key?

0 Answers  


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

2 Answers  


Is sql server is free?

0 Answers  


i have made a project i vb.net n created a .exe of it after installing it in to any pc, the database (sql express) is not geting accesed i.e the aplication cuts the link of the database, so plz help in this matter.

0 Answers  


What are the steps need to be take improve the speed of a SQLDATA Server?

2 Answers   IBM,


What’s the use of custom fields in report?

0 Answers  


Explain optimistic and pessimistic concurrency?

0 Answers  


Categories