andoni90 andoni90 - 3 months ago 30
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?


Try this:

Cursor c = mydbhelper.rawQuery("SELECT * FROM myTable Order By num",null);