title: SUM sqlite column values (android)
body: <p>I need help with summing all the values in one of the columns(<code>KEY_CONTENT6</code>) in my database(<code>MYDATABASE_TABLE</code>). I keep having force close issues, somebody tell me what I'm doing wrong!</p>
  
  <p>Heres my code:</p>
  
  <pre><code>public Cursor sumAll(){
  
   float columntotal = 0;
   Cursor cursor1 = sqLiteDatabase.rawQuery(
       "SELECT SUM("+Float.valueOf(KEY_CONTENT6)+") FROM MYDATABASE_TABLE", null);
         if(cursor1.moveToFirst()) {
           columntotal = cursor1.getFloat(0);
       }
     cursor1.close();
  
   String  sumtotal = Float.toString((float)columntotal);           
  
    return cursor1;
  
   }
  </code></pre>
  
  <p>The column <code>KEY_CONTENT6</code> is a string for various reasons which is why I used <code>Float.valueOf()</code> but I'm guessing that's where my problem is.</p>