问题描述:

When I run the following query, I get unexpected results:

String[] columns = new String[] { KEY_ROWID, KEY_NAME, KEY_SCORE };

Cursor c = mDb.query(DATABASE_TABLE, columns, null, null, null, null, KEY_SCORE + " DESC", "10");

String result = "";

So, this should sort the results by the KEY_SCORE column in my table, and sort them based on descending order. When I do this, I get the following results:

Mr Z - 72

Mr S - 70

Mr A - 50

Mr B - 50

Mr T - 130

Mr X - 125

It therefore seems to be grouping the values in two different groups. One group of two digit entries, one group of three digit entries. I need them to all be together and therefore listed correctly with the highest number at the top of the list. I know I could workaround this by having it as 050, 070, but I would prefer a clean method of solving this (or a way of removing the 0 in 070 when the value from the database is printed to the screen).

Thanks in advance!

相关阅读:
Top