1

MySQL 版本:5.5.28 phpMyAdmin - 2.11.11.3

我有多个类型的记录:name_test/、name_test/etc、name_test/etc/etc name_test/etc/etc/etc/etc,我希望它们像 Top/name_test/、Top/name_test/etc、Top/name_test /etc/etc/, Top/name_test/etc/etc/etc/etc 。

其中 90% 已经更改,因此我们只需要选择那些以“name_test/”开头的记录问题是一个问题有点复杂,我必须更改大约 400 万个字段。

**table exemple1**

**column1**             **column2**                 **column3**
name_test1              name_test2/etc              name_test3
Top/etc/etc/            Top/name_test2/etc/etc/     name_test/etc/etc/
name_test               Top/name_test/etc/
name_test               #name_test/etc/etc/etc/#
name_test               #name_test/etc/etc/#
name_test2              #name_test/etc/#
name_test5              #name_test/#
name_test/etc

我还有其他具有这样语言的表:

**table exemple2**

**column1**             **column2**                 **column3**
name_test1              italian:name_test2/etc              name_test3
Top/etc/etc/            english:Top/name_test2/etc/etc/     name_test/etc/etc/
name_test               Bulgarian:Top/name_test/etc/
name_test               Danish:#name_test/etc/etc/etc/#
name_test               Korean:#name_test/etc/etc/#
name_test2              Russian:#name_test/etc/#
name_test5              etc:#name_test/#
name_test/etc

注意:示例中只有这个#filds#必须修改

以其他方式开始的其他记录不会被修改任何帮助将不胜感激!

4

1 回答 1

2

这应该适合你:

UPDATE table
SET column2 = concat('Top/', column2)
WHERE column2 LIKE 'name_test/%'
于 2012-10-21T03:55:40.717 回答