我要做的就是按字母顺序抓取东西,而忽略大写字母。
db.rawQuery("SELECT " + catName + " FROM "+tableName+" ORDER BY "+catName+" ASC COLLATE NOCASE;", null);
这是我在上面使用的代码,但是它总是给我一个SQLite异常,表明COLLATE是语法错误。
android.database.sqlite.SQLiteException:在“ COLLATE”附近:语法错误:,而在编译时:SELECT Artist FROM testTable COLLATE NOCASE ASC
COLLATE 在订单方向之前:
COLLATE
db.rawQuery("SELECT " + catName + " FROM " +tableName +" ORDER BY "+catName+" COLLATE NOCASE ASC;", null);
但是您不需要ASC-这是默认设置,因此您可以很好地使用:
ASC
db.rawQuery("SELECT "+ catName +" FROM "+ tableName +" ORDER BY "+ catName +" COLLATE NOCASE;", null);