title: Android database SQlite sum() is not working in my case?
body: <p>I don't get what is wrong with my code please help me here</p>
  
  <pre><code>            db = this.getReadableDatabase();
              String query = "SELECT SUM(" +COLUMN_AMOUNT+ ") FROM "+TABLE_NAME+";";
              Cursor cursor = db.rawQuery(query, null);
              double monthlyTotal = 0.110;
              if(cursor.moveToFirst())
              {
                  monthlyTotal = cursor.getDouble(0);// get final total
              }
              else
                  monthlyTotal = 0.110;
  </code></pre>
  
  <p>I am always getting monthlyTotal = 0.0, even I have initialised it to 0.110</p>
  
  <p>Please check whether my onCrete() code is right or not</p>
  
  <pre><code>public void onCreate(SQLiteDatabase db) {
  
  String CREATE_MONTHS_TABLE = "CREATE TABLE " + TABLE_NAME + " (" + COLUMN_ID + " INT, " + COLUMN_DATE + " TEXT, " + COLUMN_AMOUNT + " DOUBLE, " + COLUMN_REASON + " TEXT" + ");";
  db.execSQL(CREATE_MONTHS_TABLE);
  
  }
  </code></pre>