0001 strings are stored in the database, how to carry out the four operations of integers?

such as the question: 0001 strings are stored in the database, how to perform the four operations of integers?

Apr.24,2022

convert directly to shaping and then calculate CONVERT (parameter, SIGNED)

(root)(none)-3306>>SELECT CONVERT('0001',SIGNED) + 12345 as result;
+--------+
| result |
+--------+
|  12346 |
+--------+

field1 is a string, just select field1+1234 it directly.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e680-2c43b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e680-2c43b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?