Does the MySQL TRIM function not trim line breaks or carriage returns?

后端 未结 10 1830
旧时难觅i
旧时难觅i 2020-12-03 13:58

From my experiments, it does not appear to do so. If this is indeed true, what is the best method for removing line breaks? I\'m currently experimenting with the parameters

10条回答
  •  生来不讨喜
    2020-12-03 14:18

    The answers above, when combined, work. A full example of replacing linebreaks at the beginning and end of the field looks like this:

    UPDATE table SET field=REPLACE(field, field, TRIM(BOTH '\r\n' FROM field))
    

提交回复
热议问题