MySQL Forums
Forum List  »  Newbie

Re: Copy duplicate values to new column
Posted by: Peter Brawley
Date: April 28, 2017 12:47PM

> I have invoices that are linked to email addresses.

OK, that was a design mistake, because entities that can acquire invoices often have dupe and/or changeable email addrs.

> My goal is to get rid of email duplicates on my table

Logically impossible as above.

> before dropping those duplicates, to copy the second invoice
> for one same email to a new column on my table.

Continuing, indeed compounding the design problem. Email address is not a suitable key. For one small example: entity XYZ today places an order from email address XYZ@gmail.com. By the time they make their next order, their address is orders@xyz.com. Now it's impossible to track that entity's orders.

So let's see the result of Show Create Table for the existing table, so we can figure out a sound way to solve your problem.

Meanwhile, please read a primer on relational database design; for reasons that'll immediately be obvious to you, I suggest https://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch01.pdf

Options: ReplyQuote


Subject
Written By
Posted
Re: Copy duplicate values to new column
April 28, 2017 12:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.