Custom ORDER BY to ignore 'the'

后端 未结 7 2138
野趣味
野趣味 2020-12-09 11:00

I\'m trying to sort a list of titles, but currently there\'s a giant block of titles which start with \'The \'. I\'d like the \'The \' to be ignored, and the sort to work o

7条回答
  •  半阙折子戏
    2020-12-09 11:12

    For SQLite

    ORDER BY CASE WHEN LOWER(SUBSTR(title,1,4)) = 'the ' THEN SUBSTR(title,5) ELSE title END ASC
    

提交回复
热议问题