它看起来不是很好,但它的工作原理.它从字符串中删除任何数字
SELECT
REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE (
REPLACE( REPLACE( REPLACE( REPLACE('Hallo_1234567890_99','0','')
,'1',''),'2',''),'3',''),'4',''),'5',''),'6',''),'7',''),'8',''),'9','');
update Actress
SET name = REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE (
REPLACE( REPLACE( REPLACE( REPLACE(name,'0','')
,'1',''),'2',''),'3',''),'4',''),'5',''),'6',''),'7',''),'8',''),'9','');
如果您使用MariaDB,您可以使用REGEX_REPLACE:
update Actress
set name = REGEXP_REPLACE(name,'[0-9]','');
样品
MariaDB [(none)]> SELECT REGEXP_REPLACE('A1B2C44','[0-9]','');
+--------------------------------------+
| REGEXP_REPLACE('A1B2C44','[0-9]','') |
+--------------------------------------+
| ABC |
+--------------------------------------+
1 row in set (0.00 sec)
MariaDB [(none)]>