Answer the question
In order to leave comments, you need to log in
Search and replace in MySQL table, is there an optimal solution?
There is a translation table with fields:
INSERT INTO `translate` (`translate_id`, `title_ru`, `title_en`, `type`, `cat_id`)
VALUES
(1, 'абц 0001', 'abc 0001', 1, 10),
(2, 'абц 0001', 'abc 0002', 1, 10),
(3, 'деф 0001', 'def 0001', 2, 20),
(4, 'деф 0002', 'def 0002', 2, 20),
(5, 'деф 0001', 'def 0001', 3, 30),
(6, 'деф 0001', 'def 0002', 3, 30);
PRIMARY translate_id
UNIQUE title_en, type, cat_id
INSERT INTO `translate` (`translate_id`, `title_ru`, `title_en`, `type`, `cat_id`)
VALUES
(1, 'абц 0001', 'abc 0001', 1, 10),
(2, 'абц 0001', 'abc 0002', 1, 10),
(3, 'деф 0001', 'def 0002', 2, 20),
/*(4, 'деф 0002', 'def 0002', 2, 20), дублирующаяся запись была удалена*/
(5, 'деф 0001', 'def 0002', 3, 30);
/*(6, 'деф 0001', 'def 0002', 3, 30); дублирующаяся запись была удалена*/
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question