* Bernd Tannenbaum 
> Me needs to change the format of some telephone numbers which are 
> placed in a mysql database.
> 
> Current format:       49xyz
> Wanted format:        0xyz
> 
> Now i know how to remove the leading 49:
> UPDATE table SET field=(TRIM(LEADING '49' FROM field));
> 
> But how can i replace the "49" with a "0"?
> Or maybe in 2 steps, first remove 49, then add 0?

You can do it one step, using the CONCAT function:

UPDATE table SET field=CONCAT(0,TRIM(LEADING '49' FROM field));

-- 
Roger

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to