Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android sqlite how to order by time [duplicate]

Possible Duplicate:
How do i order my SQLITE database in descending order, for an android app?

I've the following table where i'd like to select the contents of the table but order by the C_TAG_SCAN_TIME field DESC.

public static final String C_ID = BaseColumns._ID; // special for id internally in system
    public static final String C_TYPE = "type";
    public static final String C_COMPANY_ID = "companyid";
    public static final String C_PERSON_ID = "person";
    public static final String C_NAME = "name";
    public static final String C_TAG_ID = "tagid";
    public static final String C_STATUS = "status";
    public static final String C_TAG_SCAN_TIME = "tagscantime";
    public static final String C_TAG_SENTSERVER_TIME = "tagsentservertime";
    public static final String C_TRANSACTIONS_LATITUDE = "transactionslatitude";
    public static final String C_TRANSACTIONS_LONGITUDE = "transactionslongitude";

.

This is my query to select everything from the table TRANSACTIONS.

return db.query(DBHelper.TABLETRANSACTIONS, null, null, null, null, null, null);

My question is how can i change the query to order descendingly on the C_TAG_SCAN_TIME column?

like image 791
turtleboy Avatar asked Nov 26 '25 15:11

turtleboy


1 Answers

Please try this...

return db.query(DBHelper.TABLETRANSACTIONS, null, null, null, null, null, C_TAG_SCAN_TIME + " DESC");
like image 128
Nikhil Avatar answered Nov 29 '25 04:11

Nikhil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!