To replace all whitespace chars from any string in mysql, you'll have to call REPLACE
a couple of times:
SELECT
REPLACE(
REPLACE(
REPLACE(
REPLACE(fieldName, ' ', ''), -- replace spaces
'\t', '' -- replace tabs
),
'\n','' -- replace *NIX line-feeds
),
'\r', -- replace DOS line-feeds
''
);
That should cover them all. If I forgot about one, just add another REPLACE( /*replace calls here*/, '~', '')
, to add that to the list.
MySQL isn't that good at processing text, though, so whatever you'll attempt, it'll feel a tad clunky