How to sort MySQL results with letters first, symbols last?

前端 未结 4 1733
盖世英雄少女心
盖世英雄少女心 2020-12-19 13:20

Long-time reader, first-time poster here.

I\'m trying to figure out how to sort a list of artists for a music app I\'m writing.

To help understand the databa

4条回答
  •  梦毁少年i
    2020-12-19 14:14

    if you want sort by symbol first

    • ★★★ Symbol ★★★
    • 101 Hair Care
    • Abc
    • Def

    then use below query

    ORDER BY artist REGEXP '^[^A-Za-z0-9]' DESC, artist ASC
    

提交回复
热议问题