Android的源码如何通过时间订购 [英] android sqlite how to order by time

查看:134
本文介绍了Android的源码如何通过时间订购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  <一href="http://stackoverflow.com/questions/8948435/how-do-i-order-my-sqlite-database-in-descending-order-for-an-android-app">How做我为了我的SQLite数据库按降序排列,对于一个Android应用程序?

我已经在下面的表格,其中我想通过C_TAG_SCAN_TIME场DESC选择表中,但订单内容。

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);

我的问题是如何改变查询descendingly下令对C_TAG_SCAN_TIME列?

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

推荐答案

请试试这个...

return db.query(DBHelper.TABLETRANSACTIONS, null, null, null, null, null, C_TAG_SCAN_TIME + " DESC");

这篇关于Android的源码如何通过时间订购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆