Jump to content

Delete Duplicate Email Records That Are Attached To One Account But Can Be Found In Multiple Accounts


TecTao

Recommended Posts

I need Delete Duplicate Email Records That Are Attached To One Account But Can Be Found In Multiple Accounts

I have a table, consumer_mgmt.  It collects consumer information from various forms.  These forms are available through different pages that are part of a business package.

A business can offer these signups to gather names and emails from consumers for various types of specials they may offer.  So a consumer my be in the consumer_mgmt table 5, 10, 15 times for that particular business.

But, that consumer may be in the consumer_mgmt table multiple times for a different business.  So multiple times for multiple businesses.

I need to remove duplicates for each business account so the consumer is only the consumer_mgmt only once for each business.

There are approximately 15,000 rows currently in the consumer_mgmt table.

 

I'm not sure where to begin on the logic.  Since there are multiple business accounts that the emails are attached to, would one have to build a case for each loop?

Link to comment
Share on other sites

Not enough information to really answer the question. Are there more details than the email address and company associated with these records? If there are two records for the same company and the same email address - what is the logic on which record to keep? They could have different data in the other fields. And what other fields ARE there? To do this we would likely need something such as a primary key field or a timestamp to ensure we delete all but one record.

Link to comment
Share on other sites

Yes there are five other fields, three that are identifiers to the particular businesses.  Two are categories of those businesses.  These fields were added early on years ago but are not necessary to any applications.  The consumer_mgmt table handles sending out various emails for different specials.  So we are finding multiple emails going out to the same recipient that had been added multiple time.

 

I just need to pare it down so that there is one customer email for one business.  There is a field of the date of entry so if there were the need to identify which of the multiple emails should be removed, it could be the oldest.

 

I see where you are going with this, how would the script decide which entry stays and which ones get deleted.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.