0

I have a text APPLE 23 under a field Fruits. I would like to remove the spaces and get a text as APPLE23. How to i do that in postgres?

-Thanks in advance.

user2926497
  • 345
  • 2
  • 3
  • 11

2 Answers2

2

try this:

replace(mystring,' ','') to get rid of spaces in the string.
BWS
  • 3,740
  • 17
  • 25
0

To replace characters (as opposed to whole strings), translate() is even faster:

SELECT translate (mystring, ' ', '')
Erwin Brandstetter
  • 539,169
  • 125
  • 977
  • 1,137