MySQL : how to remove double or more spaces from a string?

前端 未结 11 1303
南方客
南方客 2020-12-03 08:12

I couldn\'t find this question for MySQL so here it is:

I need to trim all double or more spaces in a string to 1 single space.

For example: \"The  

11条回答
  •  隐瞒了意图╮
    2020-12-03 08:39

    If you want to update the existing column which has multiple spaces into one then this update query will be helpful:

    UPDATE your_table SET column_that_you_want_to_change= REGEXP_REPLACE(column_that_you_want_to_change, '[[:space:]]+', ' ');

提交回复
热议问题