我有一个应用程序,它使这个SQL查询到一个包含两个表的数据库,一个包含项目的表和一个包含日期集的表。每个数据集可以来自一个项目,它是一组日期(:))
从左边的连接日期集中选择不同的items.date items.inicio = datesets.capoID和items.capoID = datesets.capoID ORDER BY datesets.date
我按datesets.date排序,因为date是表示日期的整数,例如:1357340400
在android 4.X手机上,查询给出了正确的排序结果。查询的结果是:
11-28 13:24:09.457: I/System.out(9148): 16-03-2012
11-28 13:24:09.457: I/System.out(9148): 01-06-2012
11-28 13:24:09.457: I/System.out(9148): 22-06-2012
11-28 13:24:09.457: I/System.out(9148): 21-07-2012
11-28 13:24:09.457: I/System.out(9148): 26-09-2012
11-28 13:24:09.457: I/System.out(9148): 30-10-2012
11-28 13:24:09.457: I/System.out(9148): 05-12-2012
11-28 13:24:09.457: I/System.out(9148): 08-12-2012
11-28 13:24:09.457: I/System.out(9148): 27-12-2012
11-28 13:24:09.457: I/System.out(9148): 05-01-2013
11-28 13:24:09.457: I/System.out(9148): 25-02-2013
11-28 13:24:09.457: I/System.out(9148): 10-03-2013
11-28 13:24:09.457: I/System.out(9148): 23-04-2013
11-28 13:24:09.457: I/System.out(9148): 27-04-2013
11-28 13:24:09.457: I/System.out(9148): 11-05-2013
11-28 13:24:09.457: I/System.out(9148): 23-06-2013
11-28 13:24:09.457: I/System.out(9148): 01-07-2013
11-28 13:24:09.457: I/System.out(9148): 15-08-2013
11-28 13:24:09.457: I/System.out(9148): 11-09-2013
11-28 13:24:09.457: I/System.out(9148): 21-09-2013
在Android 3.2,2.3等中(低于4的版本),结果不正确,订单不正确:
11-28 13:22:50.734: I/System.out(3181): 01-06-2012
11-28 13:22:50.734: I/System.out(3181): 16-03-2012
11-28 13:22:50.734: I/System.out(3181): 21-07-2012
11-28 13:22:50.734: I/System.out(3181): 26-09-2012
11-28 13:22:50.734: I/System.out(3181): 22-06-2012
11-28 13:22:50.734: I/System.out(3181): 30-10-2012
11-28 13:22:50.734: I/System.out(3181): 08-12-2012
11-28 13:22:50.734: I/System.out(3181): 27-12-2012
11-28 13:22:50.734: I/System.out(3181): 05-01-2013
11-28 13:22:50.734: I/System.out(3181): 05-12-2012
11-28 13:22:50.734: I/System.out(3181): 25-02-2013
11-28 13:22:50.734: I/System.out(3181): 10-03-2013
11-28 13:22:50.734: I/System.out(3181): 23-04-2013
11-28 13:22:50.734: I/System.out(3181): 27-04-2013
11-28 13:22:50.734: I/System.out(3181): 11-05-2013
11-28 13:22:50.734: I/System.out(3181): 23-06-2013
11-28 13:22:50.734: I/System.out(3181): 01-07-2013
11-28 13:22:50.734: I/System.out(3181): 15-08-2013
11-28 13:22:50.734: I/System.out(3181): 11-09-2013
11-28 13:22:50.734: I/System.out(3181): 21-09-2013
编辑:
我使用thid代码打印日期:
cursor.moveToFirst();
while (cursor.isAfterLast() == false) {
System.out.println(cursor.getString(3));
cursor.moveToNext();
}