-1

I have table with values like

Book ID    email1               email2
101        abcd@test.com     abcd@test.com
102        vxyz@test.com     vxyz@test.com
105        pqrs@test.com     pqrs@test.com

I want to update all the values of email1 and email2 from test.com to testmail.com

e.g abcd@test.com  to abcd@testmail.com,
and  vxyz@test.com   to   vxyz@testmail.com  

how to write update query for this in mysql

Swadeshi
  • 1,596
  • 21
  • 33

1 Answers1

0
UPDATE table_name 
SET email1 = REPLACE(email1,'@test.com ','@testemail.com '), 
    email2 = REPLACE(email2,'@test.com ','@testemail.com ')
Nick
  • 138,499
  • 22
  • 57
  • 95
Mohamed CHIBANI
  • 147
  • 1
  • 1
  • 6