Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Duplicated records

Author  Topic 

Sep410
Posting Yak Master

117 Posts

Posted - 2008-06-09 : 12:44:44
Hi,

I have a table which has duplicated records sometimes. How can I write a query that returns only duplicated records?

Exp
Name ID Tel
John 123 99999999
Derek 548 88888888
Raj 798 777777777
John 123 99999999


I need to see:
Name ID Tel
John 123 99999999

Please help me.





Sep

jdaman
Constraint Violating Yak Guru

354 Posts

Posted - 2008-06-09 : 12:53:08
select Name, ID, Tel from YourTable
group by Name, ID, Tel
having count(*) > 1
Go to Top of Page

Sep410
Posting Yak Master

117 Posts

Posted - 2008-06-09 : 12:58:32
Thank you.

Sep
Go to Top of Page
   

- Advertisement -