我是 Java 编程新手,所以我需要一些帮助……我正在做这个积累的事情……
像这样..
Score Accumulated
10 10
40 50
60 110
and so on.......
我这里有我的代码...
public int accumulateScores(){
db = this.getReadableDatabase();
String query = "SELECT score, (SELECT sum(score) FROM "
+ TABLE_NAME+ ")" + " AS accumulated" + " FROM " + TABLE_NAME;
Cursor cursor = db.rawQuery(query, null);
if (cursor != null)
cursor.moveToFirst();
Score score = new Score(Integer.parseInt(cursor.getString(0)), cursor.getInt(1));
}
我应该怎么做才能返回列分数的总和..提前致谢..任何帮助将不胜感激..