I use rawQuery method of a SQLiteDatabase object.
When I write
db.rawQuery(“select * from xxx order by ? desc;”, new String[] {“edit_time”});
it won’t order the result.
But when I write
db.rawQuery(“select * from xxx order by edit_time desc;”, null);
it orders.
I did something wrong?
Thanks to sandis, I found I misread the document. There shouldn’t be the “;”. But removing the “;” doesn’t seem to affect anything.
As Jens said the first query:
Becomes:
Since we are not concerned with SQL injections on column names, you should use:
The selectionArgs are intended to be used in this manner: