Replace function
Use the Replace function in the following MySQL statement to remove spaces from the field and introduce the use of the MySQL replace function.
UPDATE ' v9_news ' Set description = REPLACE (description, ', ');
There are many kinds of space, there are spaces in the English state, there are spaces in the Chinese state, there are very strange spaces, in MySQL as if the distinction is more stringent, a very simple way is to copy a space character, paste into the MySQL execution, find several different spaces.
Recently converted database, a field text before and after a space, so use the Replace function to remove the space, but found that only a part of the removal, there are many spaces did not remove very strange, so found a lot of white space.
MySQL Trim function
Syntax: Trim ([{BOTH | Leading | Trailing} [REMSTR] from] str)
The following examples illustrate:
mysql> SELECT TRIM (' www111cnnet ');
-> ' Www111cnnet '
Mysql> SELECT TRIM (leading ' x ' from ' xxxwww111cnnetxxx ');
-> ' www111cnnetxxx '
Mysql> SELECT TRIM (BOTH ' x ' from ' xxxwww111cnnetxxx ');
-> ' Www111cnnet '
Mysql> SELECT TRIM (trailing ' xyz ' from ' www111cnnetxxyz ');
-> ' Www111cnnetx '