Comments - FORMAT

6 years, 3 months ago tino BuanaLabel

Dear Mr / Mrs,

How to create custom format to get the result like below:


1 2 56

Result of Number

001 002 056

I know the format on access : format(number,'000') but i don't know on mariaDB

Thank You Agustino

6 years, 3 months ago Ian Gilfillan

You could use LPAD, for example:

SELECT LPAD(56,3,0);
| LPAD(56,3,0) |
| 056          |
6 years, 3 months ago tino BuanaLabel

Thank you for reply

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.