>-----Original Message-----
>From: spacemarc [mailto:[EMAIL PROTECTED]
>Sent: Friday, December 05, 2008 8:50 AM
>To: MySQL
>Subject: SELECT with replacement chars
>
>Hi
>how can i replace, in a SELECT query, the last 3 numbers with asterisks?
>from 0123456789 to 0123456***
>
[JS]
SELECT CONCAT(LEFT(myfield,LENGTH(myfield) - 3), '***') FROM table;

If you are using a multi-byte character set, use CHAR_LENGTH() instead of
LENGTH().




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

Reply via email to