Reputation: 1874
I have a DB with users table. One of the fields is cellphone, but is as VARCHAR type. Some users modify their phone with correct and desired behavior, a number without spaces. But other users just add it and let spaces between chars.
Desired data:
5354663598
Some cases:
53 5 466 3598
In PHP I can solve this with a foreach, and later a str_replace(" ", "", $user->cellphone);
But I just want to know if there is a MySQL function for it.
Thanks!
Upvotes: 0
Views: 62
Reputation: 1874
Uhmm, solved!, thanks Ferenc Kurucz.
UPDATE users SET phone = REPLACE(phone," ","")
Upvotes: 0