以下是我从SQLite db获取数据的方法:
getReadableDatabase().rawQuery("SELECT _id, " + COLUMN_NAME_TITLE + " FROM " + TABLE_NAME + " ORDER BY " + COLUMN_NAME_TITLE + " COLLATE NOCASE ", null));
但即使我添加了 ASC ,我也永远无法解决我的问题。这就是我所拥有的:
我做错了吗?
答案 0 :(得分:0)
你必须使用orderby和ASC(升序)按字母顺序对项目进行排序。
getReadableDatabase().rawQuery("SELECT _id, " + COLUMN_NAME_TITLE + " FROM " + TABLE_NAME + " ORDER BY " + COLUMN_NAME_TITLE +"ASC"+" COLLATE NOCASE ", null))
答案 1 :(得分:0)
尝试使用LOWER
功能:
"SELECT _id, " + COLUMN_NAME_TITLE + " FROM " + TABLE_NAME + " ORDER BY LOWER(" + COLUMN_NAME_TITLE + ")"