0

I have a column named as ID in test table and it contains the data like 1,2,3, I want to change it to 001,002,003. How should I format that row to use same number of digits?

Dan
  • 9,391
  • 5
  • 41
  • 73
user59191
  • 21
  • 4
  • possible duplicate of [Add value "001" to mysql database](http://stackoverflow.com/questions/15867958/add-value-001-to-mysql-database) – Dan Jul 24 '14 at 13:55
  • another possible duplicate. http://stackoverflow.com/questions/13845866/mysql-adding-leading-numbers-to-existing-ids-in-a-column – John Ruddell Jul 24 '14 at 14:07
  • this is a duplicate. but if you want to update the table then follow the update syntax like so.. `UPDATE test_table t, ( SELECT LPAD(id, 3, '0') as temp_id FROM test_table ) as temp SET t.id = temp.temp_id WHERE t.id = temp.id;` – John Ruddell Jul 24 '14 at 14:10

0 Answers0