android - SQLite Query in non case sensitive alphabetical order -


this question has answer here:

all want grab stuff in alphabetical order , ignore capital letters.

db.rawquery("select " + catname + " "+tablename+" order "+catname+" asc collate nocase;", null); 

this code i'm using above, gives me sqlite exception saying collate syntax error.

android.database.sqlite.sqliteexception: near "collate": syntax error: , while compiling: select artist testtable collate nocase asc

collate goes before order direction:

db.rawquery("select " + catname             + " " +tablename          +" order "+catname+" collate nocase asc;", null); 

but don't need asc -- that's default use:

db.rawquery("select "+ catname              +" "+ tablename          +" order "+ catname +" collate nocase;", null); 

Comments

Popular posts from this blog

haskell - Using filter on an item in a list? -

c# - When does PreApplicationStartMethod actually get triggered to run? -

tomcat6 - Exception when stopping container for a with Spring + Quartz + Tomcat web application -