这是我从 SQLite db 获取数据的方法:
getReadableDatabase().rawQuery("SELECT _id, " + COLUMN_NAME_TITLE + " FROM " + TABLE_NAME + " ORDER BY " + COLUMN_NAME_TITLE + " COLLATE NOCASE ", null));
但是即使我添加了ASC ,我也从来没有整理好我的物品。这是我所拥有的:
难道我做错了什么?
您必须使用 orderby 和 ASC(升序)按字母顺序对项目进行排序。
getReadableDatabase().rawQuery("SELECT _id, " + COLUMN_NAME_TITLE + " FROM " + TABLE_NAME + " ORDER BY " + COLUMN_NAME_TITLE +"ASC"+" COLLATE NOCASE ", null))
尝试LOWER
功能:
"SELECT _id, " + COLUMN_NAME_TITLE + " FROM " + TABLE_NAME + " ORDER BY LOWER(" + COLUMN_NAME_TITLE + ")"