Блог

Сергей Сенаторов

Name: Sergey Senatorov

FullStack developer

from siberia with love

current: Moscow

Замена данных в mysql

Выбрать дубли и заменить https на https:
select CODE, COUNT(ID) as  CNT, GROUP_CONCAT(ID) as ID_LIST
FROM yourtable 
WHERE IBLOCK_ID = 11 GROUP BY CODE HAVING CNT > 1 LIMIT 10
#Заменить 7 на +7
UPDATE yourtable SET `PERSONAL_MOBILE` = CONCAT( '+', `PERSONAL_MOBILE`) WHERE PERSONAL_MOBILE LIKE "7%"
#Заменить 8 на +7
UPDATE yourtable SET `PERSONAL_MOBILE` = CONCAT( '+7', RIGHT(PERSONAL_MOBILE, LENGTH(PERSONAL_MOBILE) - 1)) WHERE PERSONAL_MOBILE LIKE "8%"
_