MySQL 将所有空格替换为 - [英] MySQL replace all whitespaces with -
本文介绍了MySQL 将所有空格替换为 -的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从一行中删除所有空格?我在这里看到很多相同的问题,但所有答案都使用替换选项.替换只能去除一个空格,而不是全部.
how could i remove ALL whitespaces from a row? I see here alot of same question but all answers ar to use replace option. Replace will work only to strip one spaces, not all.
例如:a b c 变成 a-b-c
ex: a b c to become a-b-c
谢谢.
推荐答案
这可以通过以下 MySQL 函数来实现:
This can be achieved with the following MySQL Function:
SELECT REPLACE( table.field, ' ', '-' ) FROM table;
这应该将所有空格替换为 -
This should replace all the whitespace to a -
这篇关于MySQL 将所有空格替换为 -的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文