取代all spaces
:
UPDATE `table` SET `col_name` = REPLACE(`col_name`, ' ', '')
删除所有tabs
人物 :
UPDATE `table` SET `col_name` = REPLACE(`col_name`, '\t', '' )
删除所有new line
人物 :
UPDATE `table` SET `col_name` = REPLACE(`col_name`, '\n', '')
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace
去除first and last space(s)
列数:
UPDATE `table` SET `col_name` = TRIM(`col_name`)
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_trim http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_trim
如果您想删除所有类型的空格,您可以组合所有这些功能:
UPDATE `table` SET `col_name` = REPLACE(REPLACE(REPLACE(`col_name`, ' ', ''), '\t', ''), '\n', '');