andoni90 andoni90 - 1 year ago 115
Android Question

Android SQLite ORDER BY not working in query

I have a DB with 6 fields, and I want to do a query ordering it by "num"

c=myDbHelper.query(m_db, new String[] {"_cod", "nombre", "flag", "cod_url", "tipo_l_menu", "num"}, null, null, null, null, "num");

With this I get the query but it is not sorted. What am I doing wrong?

Answer Source

Try this:

Cursor c = mydbhelper.rawQuery("SELECT * FROM myTable Order By num",null);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download