如何检查单列mysql中的重复文本

时间:2017-09-19 11:02:01

标签: php mysql

我的ps_product_lang表中有一千条记录。在此表中我有description_short列。它包含一些描述。

问题 在某些行中,此描述在description_short column.i中重复。我想检查description_short列text.if列文本重复,如下所示,我想用正确的文本更新列。

例如: ps_product_lang

+----------+----------------------------------------------+
| id       | description_short                            |
+----------+----------------------------------------------+
|        1 | Lorem Ipsum is simply dummy text.Lorem Ipsum |
|          | is simply dummy text.                        |
|        2 | Contrary to popular belief                   |
+----------+----------------------------------------------+
对于id = 1,

Lorem Ipsum is simply dummy text.重复。有没有办法检查并更新description_short列。

1 个答案:

答案 0 :(得分:0)

以下是REPLACE命令Link

的示例

可以帮助您的示例:

SELECT id,description_short,
REPLACE(description_short,'Lorem Ipsum is simply dummy text.Lorem Ipsum is simply dummy text.','Lorem Ipsum is simply dummy text.') 
FROM publisher 
WHERE description_short='Lorem Ipsum is simply dummy text.Lorem Ipsum is simply dummy text.';