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 2000 Forums
 Transact-SQL (2000)
 display duplicate 2

Author  Topic 

olocin
Starting Member

9 Posts

Posted - 2005-04-17 : 21:57:41
hi help on displaying duplicate values heres what i have started.

select count(col1) as valuescol1, col1
group by col1
having count(*)>1


the output

valuescol1 col1
2 John Doe
3 Mr. Smith
2 Mrs.Kidman

now wat i wnt to do is to display the values and not the count

like this

col1
John Doe
John Doe
Mr. Smith
Mr. Smith
Mrs.Kidman
Mrs.Kidman

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-04-17 : 22:03:28
Here's one way:

select col1
from myTable a
JOIN (
select col1
from myTable
group by col1
having count(*)>1
) b ON a.col1 = b.col1



Be One with the Optimizer
TG
Go to Top of Page

olocin
Starting Member

9 Posts

Posted - 2005-04-18 : 01:05:07
Your are rily good. thank you so much.. It worked
Go to Top of Page
   

- Advertisement -