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

Author  Topic 

olocin
Starting Member

9 Posts

Posted - 2005-04-14 : 21:48:33
Hi I need help on how to display duplicate values on my table w/out specifying any string.. tahnk you so much

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-15 : 01:21:47
Use the HAVING clause??? Give us an example.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-04-15 : 02:21:36
use group by with the having clause for count > 1

--------------------
keeping it simple...
Go to Top of Page

olocin
Starting Member

9 Posts

Posted - 2005-04-15 : 02:29:44
see i have table named accounts.. and have 3 columns namely (col1,col2,col3)on col1, i have dis values ("nicolo","john Doe", "nicolo", "Rana","nicolo","john Doe")
Now wat i Want to do is to display duplicate values, without using the string as reference.

Select col1 from accounts
where col1='nicolo' and 'john Doe'
-------->> not like this
Wat I need is the Opposite of DISTINCT where i can display duplicate values,



Go to Top of Page

olocin
Starting Member

9 Posts

Posted - 2005-04-15 : 02:33:21
hi jen, ill try GROUP, DEN ILL POST THE CODE AND CAN U CHECK IT? Im not dat good in SQL
Go to Top of Page

olocin
Starting Member

9 Posts

Posted - 2005-04-15 : 02:40:03
i have syntax error

Select from accounts
where col1
group by count > 1

----> cant get it right :)
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-04-15 : 04:22:51
quote:
Originally posted by olocin

i have syntax error

Select from accounts
where col1
group by count > 1

----> cant get it right :)




select col1 from accounts
group by col1
having count(*)>1

--------------------
keeping it simple...
Go to Top of Page

olocin
Starting Member

9 Posts

Posted - 2005-04-15 : 04:49:52
select col1 from accounts
group by col1
having count(*)>1
-------------------
the syntax displays only the last row in the column, it should display all same data in col1
Go to Top of Page
   

- Advertisement -