How to remove hyphens using MySQL UPDATE?

mysql, sql

Solution

You can use the `REPLACE()` function, for `UPDATE`

UPDATE yourtable
SET field = replace(field, '-', '')

See SQL Fiddle With Demo

For `SELECT`:

SELECT replace(field, '-', '') field
FROM yourtable

Problem

Possible Duplicate: How can I use mySQL replace() to replace strings in multiple records? MySQL search to ignore hyphens What is the best way to remove hyphens from a field using mysql UPDATE without php? ``` field: 211-555-1212 > 2115551212 ```

Original source

Related problems