cant remove whitespace even using trim sql

2828 views mysql
2

hai guys please help me i can't remove the whitespace eventhough im using trim()

can anybody help me

thanks

example data :' testing123'

answered question

1 Answer

6

Try using replace function

select replace(col1,' ','') as col1,
length(col1) as withSpace,length(replace(col1,' ',''))as withoutspace from t

Check demo of answer here demo solution

You can see that column withSpace shows length of text without any replacement and column withoutspace shows length of text after replacement.

posted this

Have an answer?

JD

Please login first before posting an answer.