I need a string that looks like XXXXXXXXXXXX to look like this XX-XX-XXXXXXX-X. I don\'t know of a function or pattern tool in MySQL that can do this. Do you?
One way to do that, in MySQL is to use an expression with the SUBSTRING and CONCAT functions, Like this:
CONCAT( SUBSTR(str,1,2), '-', SUBSTR(str,3,2), '-', SUBSTR(str,5,7), '-', SUBSTR(str,12,1) ) AS formatted_str