使用 GROUP BY 从 SQLiteDatabase 获取行,然后使用 SimpleCursorAdapter 呈现它们
我想显示每天在一个项目上花费的总秒数。
我想使用 SQLiteDatabase 使用下面的查询来获取行,然后使用 SimpleCursorAdapter 填充 ListView。
SELECT projectId, date, sum(endedAt-startedAt) as hours
FROM project_reports
WHERE startedAt >= 1270098000
AND endedAt <= 1272776399
GROUP BY date, projectId
I want to display total amount of seconds that was spent each day on a project.
I want to use SQLiteDatabase to fetch rows using the query below and then use SimpleCursorAdapter to fill a ListView.
SELECT projectId, date, sum(endedAt-startedAt) as hours
FROM project_reports
WHERE startedAt >= 1270098000
AND endedAt <= 1272776399
GROUP BY date, projectId
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法弄清楚如何在每个文件中执行此操作。
ItemsDbAdapter:
活动:
I couldn't figure out how to do it in each file.
ItemsDbAdapter:
Activity: