GROUP BY查询使用sqlite.query()函数函数、BY、GROUP、query

由网友(我乘夜的黑、去找梦的魇)分享简介:我有sqlite的工作和测试查询。I have sqlite working and tested query.我只是想将其转换成 sqlitedatabase.query(); 功能i just want to convert it into sqlitedatabase.query(); functions...

我有sqlite的工作和测试查询。

I have sqlite working and tested query.

我只是想将其转换成 sqlitedatabase.query(); 功能

i just want to convert it into sqlitedatabase.query(); function

select distinct id, date ,sum(goal) from goal where id=0 and date = 'Sep 15, 2015' group by id, date;

如何实现这一目标?

How to achieve this ?

推荐答案

尝试以下。

String table = goal;
String[] columns = new String[] { "distinct id", "date", "sum(goal)" };
String selection = "id=? and date=?";
String[] arguments = new String[] { "0", "Sep 15, 2015" };
String groupBy = "id, date";
String having = null;
String orderBy = null;
db.query(table, columns, selection, arguments, groupBy, having, orderBy);

见 DOC

阅读全文

相关推荐

最新文章