Friday, 15 April 2011

How to display all columns associated with duplicate emails in SQL server 2008 -


I did some research on finding a way to filter duplicate emails, so all the columns connected to these duplicate emails But I can not find any answer to help me with it.

I have currently pulled the data using the following code:

  Select Email, COUNT (email) AS email from dup_count [cem_farmers_masterinvitelist]. [Dbo]. Email by email (Email)> 1) Order by email   

This gives me the xxxxxx amount of rows I then pull any data (column) I want to be able to connect to these duplicate emails - and only duplicate.

  SELECT * FROM [marks_party_MasterInvite] [Dbo]. [Invitation list] Where in the email (select [marks_party_MasterInvite] by email. [Dbo]. [InviteList] Email hosting COUNT (email)> 1)   

I know that I'm doing something wrong, because

thanks guys,

post -text itemprop = "text">

you window functions Want to use. The following combines the count in each row, then you can use a where to get all the columns filter:

  SELECT il. * FROM (select IL *, count (*) over (via email partitions) as [cem_farmers_masterinvitelist] to cnt. [Dbo]. Inverted list) IL where CNT & gt; 1 order by email does not count   

, because when you receive each line, you are going to get a duplicate in the first query, you are getting specific emails.

No comments:

Post a Comment