I have the following line of code to query the database, which has the value “ntd” to sort in date order.
public Cursor fetchAllReminders( String maybe) {
return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID,
NAME, START_DATE_TIME, NEXT_DATE_TIME, BILL_AMOUNT, OCC_AMOUNT, REF, NEXT_DATE_TIME_ACT, SUM_OCC, OCC_PERIOD, BIL_ACT, DATE_ACT, COUNTABLE, LAST, DDEBIT, ONE_OFF,ONE_OFF2 }, REF +"=?", new String[] { maybe }, null, null, "ntd", null);
}
Am I able to add another value so it first sorts by a boolean value then by the date value?
thanks
In the Android Developers Documentation the
orderByparameter to theSQLiteDatabase.query(...)method is described as follows:this implies that you can use any valid SQL ORDER BY clause, so you should be able to pass a comma delimitted list of the columns or expressions you wish to sort by, like this: