Dennis Cote <[EMAIL PROTECTED]> wrote:
> Andrew Gatt wrote:
>> I have a table of music artist names which i'd like to output in
>> order. Normally i just use:
>>
>> select * from artists order by artist_name;
>>
>> What i'd really like to do is order the artists by name but ignore
>> any "the" or "the," preceding it.
>>
>
> You could try something like this:
>
> select * from t
> order by
>     case
>         when lower(substr(artist, 1, 3)) = 'the' then substr(artist,
>         4) when lower(substr(artist, 1, 4)) = 'the,' then
>         substr(artist, 5) else artist
>     end;

Only change the order of the tests - test for 'the,' (with comma) first, 
otherwise you'll never get to it.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to