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
  • 455
  • 2
  • 4
  • 12

2 Answers2

2

try this:

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

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

SELECT translate (mystring, ' ', '')
Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228