I can use the MySQL TRIM()
method to cleanup fields containing leading or trailing whitespace with an UPDATE
like so:
UPDATE Foo SET field = TRIM(field);
I would like to actually see the fields this will impact before this is run. I tried this but returns 0 results:
SELECT * FROM Foo WHERE field != TRIM(field);
Seems like this should work but it does not.
Anyone have a solution? Also, curious why this does not work...
As documented under The
CHAR
andVARCHAR
Types:In the definition of the
LIKE
operator, the manual states:As mentioned in this answer:
One solution:
Here is an example with RegEx