Reputation: 11829
I query certain tables of an sqlite database:
public Cursor showAllTables(){
String mySql = " SELECT name FROM sqlite_master " + " WHERE type='table' "
+ " AND name LIKE 'PR_%' ORDER BY name";
return ourDatabase.rawQuery(mySql, null);
}
I get this result:
How can I have the list ordered independently of the first letter being capital or not?
Upvotes: 2
Views: 878
Reputation: 3150
You can try this:
public Cursor showAllTables(){
String mySql = " SELECT name FROM sqlite_master " + " WHERE type='table' "
+ " AND name LIKE 'PR_%' ORDER BY lower(name)";
return ourDatabase.rawQuery(mySql, null);
}
I changed only name with lower(name).
Upvotes: 2
Reputation: 2800
You'll need to add COLLATE NOCASE
to the end of your query:
public Cursor showAllTables(){
String mySql = " SELECT name FROM sqlite_master " + " WHERE type='table' "
+ " AND name LIKE 'PR_%' ORDER BY name COLLATE NOCASE";
return ourDatabase.rawQuery(mySql, null);
}
Or you could recreate the table and add COLLATE NOCASE
to the column definition.
Upvotes: 3