If the character type length and prefix are the same,
dslr831
dslr832
dslr833
prefix dslr, the real number length is 3 digits, so sorting by characters should be enough.
Otherwise, if the amount of data is not large, just take it out and sort it in memory. Otherwise, it is recommended to use a custom function
Cut the fields out first, perhaps into a view, and then sort the view.
Follow the tips of another answer:
SELECT CONVERT(SUBSTRING(dslr, 5), INTEGER) AS dslr from table order by dslr;
If the character type length and prefix are the same,
prefix
dslr
, the real number length is 3 digits, so sorting by characters should be enough.Otherwise, if the amount of data is not large, just take it out and sort it in memory. Otherwise, it is recommended to use a custom function
Cut the fields out first, perhaps into a view, and then sort the view.
Follow the tips of another answer:
Reference:
http://stackoverflow.com/questions/5960620/convert-text-into-number-in...
If it really can’t be solved, it is recommended to handle it on the PHP side (get other languages)
SELECT SUBSTRING(dslr, 5) AS dslr from table order by --dslr;
table is the table name
5 You can change it at your own discretion
dslr is the field name