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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to display duplicate records

Author  Topic 

anil.murakonda
Starting Member

4 Posts

Posted - 2011-05-02 : 14:55:19
hi friends i have one employee table like

empid ename phone
1 A 222
2 B 111
3 C 222
4 D 111

i want to Display Duplicate records in phone column....

Please tell me how to dipaly duplicate records in phone column...

Anilchow..

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-02 : 15:07:25
select *
from tbl
where phone in
(select phone from employee group by phone having count(*) > 1)
order by phone, empid

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

anil.murakonda
Starting Member

4 Posts

Posted - 2011-06-07 : 11:18:54
Hi,

It display both records.....

Anilchow..
Go to Top of Page
   

- Advertisement -