我在mysql中有一个大表。我记录中的字符串周围是浪费空间,如下所示:
+---------------------------+----------------------------+
| anything | anything |
----------------------------------------------------------
| anything | anything |
+---------------------------+----------------------------+
现在我想要这个:
+--------+--------+
|anything|anything|
-------------------
|anything|anything|
+--------+--------+
实际上我想对所有行使用trim()
并更新它们。我怎么能这样做?
答案 0 :(得分:4)
如以下几条评论中所述:
UPDATE sometable SET column1 = TRIM(column1), column2 = TRIM(column2);