adspace


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

Is it possible to have clustered index on separate drive from original table location?

1039


Does view occupy space?

1018


explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

1132


Explain “row_number()” in sql server with an example?

1078


What is a coalesce function?

1282


How to enter binary string literals in ms sql server?

1243


What is normalization and what are the advantages of it?

1054


what is the difference between openrowset and openquery?

1193


How to remove duplicate rows from table except one?

1087


List the ways in which dynamic sql can be executed?

1085


What is the difference between for xml raw and for xml auto?

1113


Can we do dml on views?

1035


What is subquery? Explain the properties of a subquery?

1058


What is an indexed view?

1021


How do I start sql server 2017?

1015