-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,468
  • 19
  • 32

1 Answers1

0
UPDATE table_name 
SET email1 = REPLACE(email1,'@test.com ','@testemail.com '), 
    email2 = REPLACE(email2,'@test.com ','@testemail.com ')
Nick
  • 123,192
  • 20
  • 49
  • 81
Mohamed CHIBANI
  • 102
  • 1
  • 6