Custom ORDER BY to ignore 'the'

后端 未结 7 2141
野趣味
野趣味 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:13

    You can certainly arrange dynamically strip off 'The', though you'll soon find that you have to deal with 'A' and 'An' (except for the special case of titles like "A is for Alibi"). When "foreign" films enter the mix, you'll need to cope with "El" and "La" (except for that pesky edge case, "LA Story"). Then mix in some German films, and you'll need to cope with 'Der' and 'Die' (except for that pesky set of 'Die Hard' edge cases). See the pattern? You're headed down a path that keeps getting longer and more pitted with special cases.

    The way forward on this that avoids an ever-growing set of special cases is to store the title as you want it display and store the title as you want it sorted.

提交回复
热议问题