SQLite Query in non case sensitive alphabetical order
This question already has an answer here:
COLLATE
goes before the order direction:
db.rawQuery("SELECT " + catName
+ " FROM " +tableName
+" ORDER BY "+catName+" COLLATE NOCASE ASC;", null);
But you don't need the ASC
-- that's the default so you could just as well use:
db.rawQuery("SELECT "+ catName
+" FROM "+ tableName
+" ORDER BY "+ catName +" COLLATE NOCASE;", null);
add COLLATE NOCASE after orderBy String.
db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy + " COLLATE NOCASE ASC");
here, order by ASC or DESC depends on your need.
这应该也适用我认为:
db.rawQuery("SELECT "+ catName
+" FROM "+ tableName
+" ORDER BY lower("+ catName +");", null);
链接地址: http://www.djcxy.com/p/67468.html
上一篇: Laravel雄辩:所有订单结果()
下一篇: SQLite查询以不区分大小写的字母顺序