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
 Old Forums
 CLOSED - General SQL Server
 finding duplicates

Author  Topic 

ldrenning
Starting Member

23 Posts

Posted - 2006-08-28 : 09:31:28
I have a list of several thousand records and I am looking to find only the records where the site_id is listed more than once in the table. Here is what the table looks like.

TABLE 1
ID (key)
SITE_ID
NAME
ACCOUNT

THANKS!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-28 : 09:58:34
Select Site_Id from yourTable
group by Site_Id having count(*)>1

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-28 : 09:58:46
select site_id from table group by site_id having count(*) > 1

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-28 : 09:59:17
Ouch! Shoot the yak icon will be here soon...

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2006-08-28 : 10:16:23

like this [SNIPED]
just lower case



For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-28 : 11:54:12
quote:
Originally posted by Peso

Ouch! Shoot the yak icon will be here soon...

Peter Larsson
Helsingborg, Sweden


Often you forget that

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ldrenning
Starting Member

23 Posts

Posted - 2006-08-28 : 14:27:16
sorry :-(
Go to Top of Page
   

- Advertisement -