Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

display duplicate columns Expand / Collapse
Author
Message
Posted Wednesday, January 01, 2003 2:17 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, January 24, 2004 7:27 PM
Points: 23, Visits: 1
Hi,
I'm trying to import a table to a new database design and I have a unique constraint on the 'email' column. The old table i'm trying to import has duplicates in the email column.

How can I view all the duplicates for a particular column in a table?

Its something like Having (count(*)) > 1 or something?






Post #9053
Posted Wednesday, January 01, 2003 3:19 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Tuesday, June 11, 2013 6:34 AM
Points: 6,463, Visits: 1,388
Exactly. You can set the ignore dupe option to just get all the unique rows - if that makes sense in your situtation.

Andy
http://www.sqlservercentral.com/columnists/awarren/




Andy
SQLShare - Learn One New Thing Each Day
SQLAndy - My Professional Blog
Connect with me on LinkedIn
Follow me on Twitter
Post #50636
Posted Wednesday, January 01, 2003 6:18 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, January 24, 2004 7:27 PM
Points: 23, Visits: 1
Andy, can you give me the query. I'm not sure what it is ...




Post #50637
Posted Wednesday, January 01, 2003 6:35 PM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Tuesday, June 11, 2013 6:34 AM
Points: 6,463, Visits: 1,388
Sure. This works in Northwind.

select productid, count(*) as count from [order details] group by productid having count(*)>1


Andy
http://www.sqlservercentral.com/columnists/awarren/




Andy
SQLShare - Learn One New Thing Each Day
SQLAndy - My Professional Blog
Connect with me on LinkedIn
Follow me on Twitter
Post #50638
Posted Thursday, October 18, 2012 7:22 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, May 29, 2013 2:54 AM
Points: 2, Visits: 54
Hi
I'm very new to sql....
I would like to display duplicate emails but also their respective account numbers from a table but can only work out how to pull the duplicates.... Do I need to insert the below into another statement please? Hope you can help....

select emailaddress, count (*) from
vwdimcustomer
group by emailaddress
having count (*) > 1

Sorted
Post #1374341
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse