shwq.net
当前位置:首页 >> sqlitE3 如何对结果排序? >>

sqlitE3 如何对结果排序?

select * from (select * from test order by id desc limit 3) order by id asc ; 可以将查询结果重新排序

我来为您解答: 可以用db.rawQuery("select * from 表名 orderby KEY_ENDTIME",null);来写,升序降序的看楼上,该方法返回的也是Cursor KEY_ENDTIME ASC 升序 KEY_ENDTIME DESC 降序 你保存时间类型应该就可以了。实在不行搞个时间错保存long。

select * from tablename order by create asc ;//升序select * from tablename order by create desc // 降序

$ sqlite3SQLite version 3.7.13 2012-06-11 02:05:22Enter ".help" for instructionsEnter SQL statements terminated with a ";"sqlite> create table tb_tmp (id int);sqlite> insert into tb_tmp values (1);sqlite> insert into tb_tmp val...

排序是在你的SQL语句中进行的,如SELECT ... ORDER BY ctime, sqlite3_get_table只是获取你sql语句的执行结果,得到一个一维数组,先记录字段名 接下来为字段的值

sqlite中存数据的时候是按照存入的顺序排的,因为设置了Id自增长,所以查出是数据也就是按id 升序排序。你可以自己写sql语句,api那个参数太多,不习惯 如果自己写sql语句的话,怎么把变量的值传入呢? 比如: db.exexSQL("select some_columns ...

$ sqlite3SQLite version 3.7.13 2012-06-11 02:05:22Enter ".help" for instructionsEnter SQL statements terminated with a ";"sqlite> create table tb_tmp (id int);sqlite> insert into tb_tmp values (1);sqlite> insert into tb_tmp val...

select name,score from tablename order by score desc

ORDER BY [列1] ASC, [列2] DESC, [列3] ASC升序, DESC倒序, 升序可以省略

你按A字段排序了,当然就排序了啊

网站首页 | 网站地图
All rights reserved Powered by www.shwq.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com