更新时间:2022-04-09 22:56:09
做到这一点,只需选择最右边的3个字符并按该值升序进行排序即可.
This will do it, very simply selecting the right-most 3 characters and ordering by that value ascending.
SELECT *
FROM table_name
ORDER BY RIGHT(name, 3) ASC;
应该补充的是,随着数据的增长,这将成为一种低效的解决方案.最终,您可能希望将数字附录存储在单独的索引整数列中,以使排序效率达到***.
It should be added that as your data grows, this will become an inefficient solution. Eventually, you'll probably want to store the numeric appendix in a separate, indexed integer column, so that sorting will be optimally efficient.