doucong1268 2015-05-27 15:30
浏览 128
已采纳

如何使用trim()并更新mysql中的所有行[复制]

This question already has an answer here:

I have a big table in mysql. Around the string in my record is waste space, something like this:

+---------------------------+----------------------------+
|        anything           |           anything         |
----------------------------------------------------------
|        anything           |           anything         |
+---------------------------+----------------------------+

Now i want this:

+--------+--------+
|anything|anything|
-------------------
|anything|anything|
+--------+--------+

In fact i want to use trim() for all rows and update them. how can i do that ?

</div>
  • 写回答

1条回答 默认 最新

  • doulang6013 2015-05-27 15:34
    关注

    As noted in several the comments:

    UPDATE sometable SET column1 = TRIM(column1), column2 = TRIM(column2);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?