关于android sqlite的date类型排序有关问题
关于android sqlite的date类型排序问题
我有一个数据库表:tell
create table tell (
_id integer primary key autoincrement,
testDate date
);
表数据:
_id testDate
1 '2012-3-4'
2 '2012-3-5'
3 '2012-3-15'
4 '2012-4-9'
5 '2012-11-3'
查询语句:
select testDate from tell order by testDate desc
结果:
2012-4-9
2012-3-5
2012-3-4
2012-3-15
2012-11-3
结果和数据的排序相差甚远!!
求帮忙解释
如何才能得到正确的排序。
非常感谢!在线等
------解决方案--------------------
android 上也能用hibernate框架了
http://blog.****.net/kechanghe0705/article/details/6702890
------解决方案--------------------
看了你的数据和排序结果,感觉根本没有按照日期类型排序,而是字符串类型排序的
现在有两种解决方法 要不你入库规范点儿 2012-3-4 入库为 2012-03-04
要不你就修改数据类型
------解决方案--------------------
看样子是按字符串排序了,没有按日期
我有一个数据库表:tell
create table tell (
_id integer primary key autoincrement,
testDate date
);
表数据:
_id testDate
1 '2012-3-4'
2 '2012-3-5'
3 '2012-3-15'
4 '2012-4-9'
5 '2012-11-3'
查询语句:
select testDate from tell order by testDate desc
结果:
2012-4-9
2012-3-5
2012-3-4
2012-3-15
2012-11-3
结果和数据的排序相差甚远!!
求帮忙解释
如何才能得到正确的排序。
非常感谢!在线等
------解决方案--------------------
android 上也能用hibernate框架了
http://blog.****.net/kechanghe0705/article/details/6702890
------解决方案--------------------
看了你的数据和排序结果,感觉根本没有按照日期类型排序,而是字符串类型排序的
现在有两种解决方法 要不你入库规范点儿 2012-3-4 入库为 2012-03-04
要不你就修改数据类型
------解决方案--------------------
看样子是按字符串排序了,没有按日期