1
I have a client table, and a command field of varchar type.
Cpf is stored without mask. Ex:"00751595170"
I would like to do a select that format the result by putting on the masks. "007.515.951.70"
1
I have a client table, and a command field of varchar type.
Cpf is stored without mask. Ex:"00751595170"
I would like to do a select that format the result by putting on the masks. "007.515.951.70"
2
You can select parts of the field SUBSTR
and concatenate CONCAT
with symbols to apply formatting, example:
SELECT
CONCAT (
SUBSTR('11111111122',1,3),'.',
SUBSTR('11111111122',4,3),'.',
SUBSTR('11111111122',7,3),'-',
SUBSTR('11111111122',10)) as cpf;
Browser other questions tagged mysql select
You are not signed in. Login or sign up in order to post.
Why not put the mask on the front end with Javascript or some function in your View? You really need to put the mask inside select?
– Tiago Davi
Yes, I do. Thank you.
– durtto