sql - Sqlite multi level sorting and grouping -


i have table contains flowing columns:

id name  (it can numeric, symbols, english , other language) fname (name in capitals) 

i need output per below criteria:

list should grouped 3 categories

  1. number
  2. symbols
  3. english , other language names

further criteria 3rd category is:

  1. small , capital letter should sorted (small first capital).
  2. for each index (a-z) english , other language names should ordered a. latin first b. english

example :

**id  | fname** 2   | 123 7   | 111 1   | :) 8   | ^_^ 3   | apple 5   | apple 6   | 男孩 (boy) 4   | boy 

i have tried using 'as' key word group them numeric,symbol , english/other names , sub category have used (substr(fname,1,1) < 'zz') no luck.

ordering them using makes every thing mixed.

sample query:

select *    (select id,name,fname, 1 orderstr      emp     id in (     select id emp fname glob '[a-z]*')     union       select id,name,fname,3 orderstr       emp       fname glob '[0-9]*'     union       select id,name,fname, 2 orderstr       emp              fname not glob '[a-z]*' , fname not glob '[0-9]*' ) order orderstr, (substr(fname,1,1) < 'zz') 

please me getting desired result.

thanks in advance.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -