MySQL Removing trailing linebreaks from a column

后端 未结 6 2043
夕颜
夕颜 2021-01-05 15:29

I want to remove trailing line breaks from my MySQL column. trim() only removes whitespaces but I also want to remove trailing linebreaks. Could anyone suggest?

6条回答
  •  鱼传尺愫
    2021-01-05 15:49

    Another vote for Wallack's idea, but more specifically:

    Update YOURTABLENAME set YOURCOLUMNNAME = replace(YOURCOLUMNNAME, '\r\n','')
    

    Essentially this should replace carriage returns and breaks with nothing.

    Good luck.

提交回复
热议问题