Replace in MySQL -


in database have few records these 2 columns:

 id, name,  11,  meal 997, 12,  meal 998, 13,  meal 999, 14,  meam 000, 15,  meam 001, 16,  meam 002, 

but issue in application wrong data due logical error. how can change records containing meam meal , continue incrementing?

the above records should these:

11,  meal 997, 12,  meal 998, 13,  meal 999, 14,  meal 1000, 15,  meal 1001, 16,  meal 1002, 

how can change database?

"meam 001" in 1 columm

what query be?

update tablename set name=replace(name,'meam','meal 1') name "meam%" 

you can test with:

select name, replace(name,'meam','meal 1') tablename 

;)


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -