Natural Sort in MySQL

后端 未结 21 1366
南旧
南旧 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:50

    I think this is why a lot of things are sorted by release date.

    A solution could be to create another column in your table for the "SortKey". This could be a sanitized version of the title which conforms to a pattern you create for easy sorting or a counter.

提交回复
热议问题