Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

strip all spaces from column in mysql?

Tags:

sql

mysql

i have a table that has

'number'

1234
12 34
1 2 34
1 2 3 4
ect...

so, im wondering how can i write a query that will remove all spaces?

something like

update `table` set number = REPLACE( ' ', '', (select 'number' from `table`));  

is there anything that will do this?

like image 581
Hailwood Avatar asked Jul 19 '10 07:07

Hailwood


1 Answers

Close. I believe you could write something like this:

update `table` set number = REPLACE( number, ' ', '');
like image 155
John P Avatar answered Sep 18 '22 22:09

John P