3

可能重复:
对于 android 应用程序,我如何按降序排列我的 SQLITE 数据库?

我有下表,我想在其中选择表的内容,但按 C_TAG_SCAN_TIME 字段 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";

.

这是我从表 TRANSACTIONS 中选择所有内容的查询。

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

我的问题是如何将查询更改为在 C_TAG_SCAN_TIME 列上按降序排列?

4

1 回答 1

8

请试试这个...

return db.query(DBHelper.TABLETRANSACTIONS, null, null, null, null, null, C_TAG_SCAN_TIME + " DESC");
于 2012-10-19T12:21:29.520 回答