
public HashMap<String, Object> Get_Info(int id){
HashMap<String, Object> map = new HashMap<String, Object>()
String sql = "SELECT * FROM " + TABLENAME +" WHERE ID='" +id +"'"
Cursor result = this.db.rawQuery(sql, null) // 执行查询语句
for (result.moveToFirst() !result.isAfterLast() result.moveToNext()) { // 采用循环的方式检索数据
map.put("A", result.getString(1))
map.put("B", result.getString(2))
map.put("B", result.getInt(3))
}
this.db.close()
return map
}
查询语句:select * from 表名 where 条件子句 group by 分组字句 having ... order by 排序子句 (顺序一定不能错)如:
[sql] view plain copy
select * from person
select * from person order by id desc
select name from person group by name having count(*)>1
分页SQL与mysql类似,下面SQL语句获取5条记录,跳过前面3条记录
[sql] view plain copy
select * from Account limit 5 offset 3
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)