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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What triggers long term care?

552


what information is maintained within the msdb database? : Sql server administration

509


What are cursors? Explain the different types of cursors Enlist a few disadvantages of cursors.

615


What are the recovery models in sql server 2000?

553


You are designing a database for your human resources department in the employee table, there is a field for social security number, which cannot contain null values if no value is given, you want a value of unknown to be inserted in this field what is the best approach?

615






What is filter index?

514


Should you normalize audio?

525


Explain what is lock escalation?

573


Explain isolation levels that sql server supports?

565


How to create stored procedures with parameters in ms sql server?

526


between cast and convert which function would you prefer and why?

531


Explain different types of locks in sql server.

594


How to check status of stored procedure in sql server?

443


What are the difference between “where” and “having” clause in sql server?

581


What is the tcp/ip port on which sql server runs?

561