Answer the question
In order to leave comments, you need to log in
How to bulk change image extension to your own format in MYSQL database?
It's hard to explain that's why I'm attaching a screenshot:
Images in the database are stored both in .PNG and .WEBP formats.
I want to massively, with 1 request, change all lines where the PNG extension is to the WEBP extension.
How to do it?
Answer the question
In order to leave comments, you need to log in
With this request, you study very carefully whether the result of converting strings to result_mod_f1 from mod_f1, and result_mod_f2 from mod_f2 satisfies you.
select mod_f1, replace(mod_f1, '.png', '.webp') as result_mod_f1,
mod_f2, replace(mod_f2, '.png', '.webp') as result_mod_f2
from table
/*update table
set mod_f1 = replace(mod_f1, '.png', '.webp'),
mod_f2 = replace(mod_f2, '.png', '.webp')*/
/*update table
set mod_f1 = replace(mod_f1, '.png', '.webp'),
mod_f2 = replace(mod_f2, '.png', '.webp')
where mod_f1 like '%.png%'
or mod_f2 like '%.png%'
LIMIT 1000 */
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question