How to fix emails containing double dot in domain?

How do I update an email containing a double dot in its domain using raw mysql query?

So I have these emails having this format [email protected] and turn it to this [email protected]

Answer

replace should do the trick:

UPDATE mytable
SET    email = REPLACE(email, '..', '.')
WHERE  email LIKE '%..%'

Leave a Reply

Your email address will not be published. Required fields are marked *