【问题标题】:Remove spaces from the text and combine them into a single text [duplicate]从文本中删除空格并将它们组合成一个文本[重复]
【发布时间】:2014-01-05 12:16:10
【问题描述】:

我在“水果”字段下有一个文本 APPLE 23。我想删除空格并获得一个文本为 APPLE23。我如何在 postgres 中做到这一点?

-提前致谢。

【问题讨论】:

    标签: postgresql


    【解决方案1】:

    试试这个:

    replace(mystring,' ','') to get rid of spaces in the string.
    

    【讨论】:

    • 非常感谢。它成功了。
    • 酷...有时就这么简单!
    【解决方案2】:

    要替换字符(而不是整个字符串),translate() 更快:

    SELECT translate (mystring, ' ', '')
    

    【讨论】:

    • 非常感谢。我会记住这一点。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-28
    • 2018-11-04
    • 2023-03-24
    • 1970-01-01
    • 1970-01-01
    • 2010-10-19
    • 1970-01-01
    相关资源
    最近更新 更多