mardi 2 février 2016

How to sort the names in sqlite when special characters are present

I have a sqlite Database in my project which i use to store the names of persons with phonebook and address. So currently whenever we get the names inserted into DB, we do the sorting in alphabetic order and hence we could see these names as expected on the display. Now recently customer has come up with names which starts with special character like ō(Umlaut),ù etc. The expectation is that we need to display in such a way that names starting with ō should come right after 'o'(English alphabet) but before the letter 'p'(English alphabet). Similarly names starting with ù should come after the letter 'u' but before the letter 'v'. I need help to write a query for this as i have no idea as to how we need to sort the sql query.

The query which we use currently is as shown below:

****SELECT *FROM MyTable1 ORDER BY lower(Name)****

For eg;If i have names such as Omni,ōuter,Picaso,Zebra

The DB after sorting in alphabetic order should come as

Name       Num0    Num1    Num2   Num3   Num4  Num5   Num6  Num7
Omni       1243
ōuter      1111
Picaso     2222
Zebra      3333

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire