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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 finding duplicates
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

ldrenning
Starting Member

23 Posts

Posted - 08/28/2006 :  09:31:28  Show Profile
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

India
22864 Posts

Posted - 08/28/2006 :  09:58:34  Show Profile  Send madhivanan a Yahoo! Message
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

Sweden
30421 Posts

Posted - 08/28/2006 :  09:58:46  Show Profile  Visit SwePeso's Homepage
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

Sweden
30421 Posts

Posted - 08/28/2006 :  09:59:17  Show Profile  Visit SwePeso's Homepage
Ouch! Shoot the yak icon will be here soon...

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

DonAtWork
Flowing Fount of Yak Knowledge

2167 Posts

Posted - 08/28/2006 :  10:16:23  Show Profile

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

India
22864 Posts

Posted - 08/28/2006 :  11:54:12  Show Profile  Send madhivanan a Yahoo! Message
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 - 08/28/2006 :  14:27:16  Show Profile
sorry :-(
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000