Reputation: 4721
I have a table in MySQL that is titled accounts, inside of accounts I have: email, first_name, last_name, etc. What I'd like to do is replace all of the email accounts to a generic value, but have each one contain an incremented value at the end. How can I do this in sql?
So for example, [email protected] would turn into [email protected] and the next would go from [email protected] to [email protected], and so on.
Upvotes: 0
Views: 577
Reputation: 4062
SET @seq = 0;
UPDATE users SET email = CONCAT('replacedemail', @seq := @seq + 1, '@gmail.com')
Upvotes: 1