0
|      382 | Ongoing     |
|      383 | Ongoing     |
|      384 | Ongoing     |
|      385 | Ongoing     |
|      386 | 
Ongoing
   |
|      387 | 
Ongoing
   |
|      388 | 
Ongoing
   |
|      389 | 
Ongoing
   |
|      390 | 
Ongoing
   |
|      391 | 
Ongoing

Above is my sql, somehow or somewhat I did some mistake when insert the value.

I wanna do a str replace to replace the empty "spaces"

I did the following

update content set status = replace(status,' ','');

It replace 19 rows, then I tried again, it replace 0 rows. but the empty spaces still exist.

How do I solve this by str_replace at mysql

Thanks!

Manga Black
  • 197
  • 2
  • 9
  • 1
    possible duplicate of [MySQL - how to remove white space in a mysql field](http://stackoverflow.com/questions/6858143/mysql-how-to-remove-white-space-in-a-mysql-field) – Muhammet Arslan Aug 27 '15 at 19:03

2 Answers2

1

You're looking for TRIM.

UPDATE FOO set FIELD2 = TRIM(FIELD2);
Muhammet Arslan
  • 975
  • 1
  • 9
  • 33
0

Found it..

UPDATE content set status = TRIM(Replace(Replace(Replace(status,'\t',''),'\n',''),'\r',''));
Manga Black
  • 197
  • 2
  • 9