Natural Sort in MySQL

后端 未结 21 1492
南旧
南旧 2020-11-22 02:25

Is there an elegant way to have performant, natural sorting in a MySQL database?

For example if I have this data set:

  • Final Fantasy
  • Final Fant
21条回答
  •  半阙折子戏
    2020-11-22 02:51

    Just found this:

    SELECT names FROM your_table ORDER BY games + 0 ASC
    

    Does a natural sort when the numbers are at the front, might work for middle as well.

提交回复
热议问题