MySQL删除整个列中的所有空格

有没有办法从所有值的特定列中删除所有的空格?

replaceall 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

删除列的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

工作查询:

SELECT replace(col_name , ' ','') FROM table_name;

虽然这不:

SELECT trim(col_name) FROM table_name;

由于问题是如何取代所有的空格

 UPDATE `table` SET `col_name` = REPLACE (REPLACE(REPLACE(`col_name`, ' ', ''), '\t', ''), '\n', ''); 

使用下面的查询可以删除MySQL中的前导和尾随空白。

 UPDATE `table_name` SET `col_name` = TRIM(`col_name`); 

只需使用下面的sql,你就完成了:

 SELECT replace('Hi How are you',' ', '') output = HiHowareyou