Java cursor.getCount()返回1,但应返回0

Java cursor.getCount()返回1,但应返回0,java,android,Java,Android,我有一个问题是 SELECT SUM(amount) AS total FROM transactions WHERE transaction_date > 1477333800 对于此查询,cursor.getCount()将返回1。但是当遍历游标时,该值将变为null public Cursor getTotalForToday(long start) { SQLiteDatabase db = this.getReadableDatabase();

我有一个问题是

SELECT SUM(amount) AS total FROM transactions WHERE transaction_date > 1477333800
对于此查询,
cursor.getCount()
将返回
1
。但是当遍历游标时,该值将变为null

public Cursor getTotalForToday(long start)
{
    SQLiteDatabase db = this.getReadableDatabase();        
    Cursor c = db.rawQuery("SELECT SUM(amount) AS total FROM "+TRANSACTION_TABLE+" WHERE transaction_date > "+start, null);
    return c;
}

Cursor cursor = db.getTotalForToday();
if(cursor.getCount() == 0) // this is evaluating to false
{
     forToday.setText("Zero"); //forToday is TextView
}
else
{
   while(cursor.moveToNext())
   {
       String total_today = cursor.getString(0); // this is returning null
       forToday.setText(total_today);
   }
}
备注:
金额的数据类型为表中的整数

如果我在SQLLite Firefox扩展中查询相同的内容,我将得到以下输出

理想情况下,返回的行数应该是0,但我不知道为什么返回为1。 以下是表btw中的数据:

聚合SQL函数,例如
SUM()
始终返回结果行。结果本身可以为空。

聚合SQL函数,例如
SUM()
始终返回结果行。结果本身可以为空。

该死!这就是我刚才想出来的。第一张截图中的红色背景是一个很好的提示。该死!这就是我刚才想出来的。第一张截图中的红色背景是一个很好的提示。