Answer the question
In order to leave comments, you need to log in
How to replace a substring in a Mysql table with a randomly selected emoji from a list?
Good day!
There is a problem, in the database, when transferring, emoji were rubbed and changed to a question mark "?", there were emoji of the form: .
How to correctly compose a mysql query to replace a character ? in the field of the table on a randomly selected emoji from the list?
UPDATE `modx_site_content` SET `longtitle` = REPLACE(`longtitle`, ' ? ', ' ');
Answer the question
In order to leave comments, you need to log in
UPDATE
`modx_site_content` t1
SET t1.`longtitle` = REPLACE(`longtitle`, ' ? ',
(
select t2.*
from
(
select 'a'
union
select 'b'
union
select 'c'
) t2
order by rand() limit 1
)
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question