mysql - Query With CONCAT and LOOP using SELECT -


i got kind of column:

------------------ |reference_number| ------------------ |1               | |12              | |123             | |1234            | |12345           | |123456          | |1234567         | |12345678        | |123456789       | |1234567890      | ------------------ 

i want achieve kind of output using mysql query:

------------------ |reference_number| ------------------ |0000000001      | |0000000012      | |0000000123      | |0000001234      | |0000012345      | |0000123456      | |0001234567      | |0012345678      | |0123456789      | |1234567890      | ------------------ 

what i'm doing right now:

select concat('000000000', reference_number) example 

but work 1st record, know easy using programming language such php or java, can advise how using mysql?

there lpad.

select lpad(reference_number, 10, '0') example 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -