从mysql中的列中删除所有空格?

时间:2022-06-08 00:09:50

i have a table that has

我有一张桌子

'number'

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

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

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?

有什么能做到的吗?

2 个解决方案

#1


11  

Close. I believe you could write something like this:

关。我相信你可以这样写:

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

#2


5  

UPDATE table SET number = REPLACE(number, ' ', '')

#1


11  

Close. I believe you could write something like this:

关。我相信你可以这样写:

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

#2


5  

UPDATE table SET number = REPLACE(number, ' ', '')