Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Mysql Not replacing whole string with a wildcard?

I am trying to remove junk after .com and .net in a huge list of emails I have so its just an email address with nothing after it. Example, an email is "abc@yahoo.com 19.45.16.20" I need to remove those numbers so I tried writing this query to replace anything after the m in .com to see if it would work,

mysql> update email set email = '%m ' where email not like '%.com' and email not

like '%.edu' and email not like '%.org' and email not like '%.gov';

The problem is, its replacing the whole email address with %m and not just getting rid of junk after the m in .com! Any ideas how I can just replace till the m in .com and the n in .net etc? Thank you!

1 Answer

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    try

    set email = LEFT(email, INSTR(email, '.com')+3)

Still have questions? Get your answers by asking now.